rename shell -> shell.lua

This commit is contained in:
kepler155c@gmail.com 2019-02-12 17:03:50 -05:00
parent 2d411df7d1
commit ae6d8e8ebd
13 changed files with 25 additions and 34 deletions

View File

@ -6,7 +6,7 @@ local term = _G.term
local bootOptions = {
{ prompt = os.version() },
{ prompt = 'Opus' , args = { '/sys/boot/opus.boot' } },
{ prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell' } },
{ prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell.lua' } },
{ prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.boot' } },
}
local bootOption = 2

View File

@ -25,8 +25,8 @@ function Terminal.window(parent, sx, sy, w, h, isVisible)
width = w,
height = h,
isColor = parent.isColor(),
offy = 0,
})
canvas.offy = 0
win.canvas = canvas
@ -164,7 +164,7 @@ function Terminal.window(parent, sx, sy, w, h, isVisible)
function win.redraw()
if isVisible then
canvas:dirty()
canvas:render(parent)
update()
end
end

View File

@ -198,10 +198,12 @@ function Canvas:blit(x, y, text, bg, fg)
end
function Canvas:writeLine(y, text, fg, bg)
self.lines[y].dirty = true
self.lines[y].text = text
self.lines[y].fg = fg
self.lines[y].bg = bg
if y > 0 and y <= #self.lines then
self.lines[y].dirty = true
self.lines[y].text = text
self.lines[y].fg = fg
self.lines[y].bg = bg
end
end
function Canvas:clearLine(y, bg, fg)

View File

@ -15,20 +15,12 @@ UI.Checkbox.defaults = {
backgroundColor = colors.black,
backgroundFocusColor = colors.lightGray,
height = 1,
width = 3,
accelerators = {
space = 'checkbox_toggle',
mouse_click = 'checkbox_toggle',
}
}
function UI.Checkbox:setParent()
if not self.width and not self.ex then
self.width = (self.label and #self.label or 0) + 3
else
self.width = 3
end
UI.Window.setParent(self)
end
function UI.Checkbox:draw()
local bg = self.backgroundColor
if self.focused then

View File

@ -347,7 +347,7 @@ function Browser:eventHandler(event)
self:run('cedit', file.name)
elseif event.type == 'shell' then
self:run('sys/apps/shell')
self:run('sys/apps/shell.lua')
elseif event.type == 'refresh' then
self:updateDirectory(self.dir)

View File

@ -1,8 +1,5 @@
if not _G.requireInjector then
local BASE ='https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/apis'
_ENV.LUA_PATH=BASE .. '/?.lua'
load(_G.http.get(BASE .. '/injector.lua').readAll())()(_ENV)
end
-- Lua may be called from outside of shell - inject a require
_G.requireInjector(_ENV)
local History = require('history')
local UI = require('ui')

View File

@ -424,7 +424,7 @@ function page:eventHandler(event)
shell.switchTab(shell.openTab(event.button.app.run))
elseif event.type == 'shell' then
shell.switchTab(shell.openTab('sys/apps/shell'))
shell.switchTab(shell.openTab('sys/apps/shell.lua'))
elseif event.type == 'lua' then
shell.switchTab(shell.openTab('sys/apps/Lua.lua'))

View File

@ -36,7 +36,6 @@ local page = UI.Page {
description = UI.TextArea {
x = 16, y = 3, ey = -5,
marginRight = 0, marginLeft = 0,
--backgroundColor = colors.white,
},
load = UI.Button {
x = 22, y = -3,
@ -45,10 +44,8 @@ local page = UI.Page {
help = 'Download the latest package list',
},
action = UI.SlideOut {
backgroundColor = colors.brown,
y = 3,
backgroundColor = colors.cyan,
titleBar = UI.TitleBar {
backgroundColor = colors.brown,
event = 'hide-action',
},
button = UI.Button {

View File

@ -314,9 +314,9 @@ function shell.newTab(tabInfo, ...)
tabInfo.args = args
tabInfo.title = fs.getName(path):match('([^%.]+)')
if path ~= 'sys/apps/shell' then
if path ~= 'sys/apps/shell.lua' then
table.insert(tabInfo.args, 1, tabInfo.path)
tabInfo.path = 'sys/apps/shell'
tabInfo.path = 'sys/apps/shell.lua'
end
return _ENV.multishell.openTab(tabInfo)
end
@ -329,10 +329,10 @@ function shell.openTab( ... )
local sCommand = tWords[1]
if sCommand then
local sPath = shell.resolveProgram(sCommand)
if sPath == "sys/apps/shell" then
if sPath == "sys/apps/shell.lua" then
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), sPath, table.unpack(tWords, 2))
else
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), "sys/apps/shell", sCommand, table.unpack(tWords, 2))
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), "sys/apps/shell.lua", sCommand, table.unpack(tWords, 2))
end
end
end

3
sys/autorun/upgraded.lua Normal file
View File

@ -0,0 +1,3 @@
if fs.exists('sys/apps/shell') and fs.exists('sys/apps/shell.lua') then
fs.delete('sys/apps/shell')
end

View File

@ -64,7 +64,7 @@ else
fs.mount('', 'gitfs', GIT_REPO)
end
local s, m = pcall(run, 'sys/apps/shell', 'sys/kernel.lua', ...)
local s, m = pcall(run, 'sys/apps/shell.lua', 'sys/kernel.lua', ...)
if not s then
print('\nError loading Opus OS\n')

View File

@ -278,7 +278,7 @@ local function init(...)
kernel.hook('kernel_ready', function()
local s, m = kernel.run({
title = args[1],
path = 'sys/apps/shell',
path = 'sys/apps/shell.lua',
args = args,
haltOnExit = true,
haltOnError = true,

View File

@ -46,7 +46,7 @@ local function telnetHost(socket)
title = 'Telnet client',
hidden = true,
co = coroutine.create(function()
Util.run(_ENV, 'sys/apps/shell', table.unpack(termInfo.program))
Util.run(_ENV, 'sys/apps/shell.lua', table.unpack(termInfo.program))
if socket.queue then
socket:write(socket.queue)
end