mirror of
https://github.com/kepler155c/opus
synced 2025-01-17 02:42:52 +00:00
rename shell -> shell.lua
This commit is contained in:
parent
2d411df7d1
commit
ae6d8e8ebd
2
startup
2
startup
@ -6,7 +6,7 @@ local term = _G.term
|
|||||||
local bootOptions = {
|
local bootOptions = {
|
||||||
{ prompt = os.version() },
|
{ prompt = os.version() },
|
||||||
{ prompt = 'Opus' , args = { '/sys/boot/opus.boot' } },
|
{ 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' } },
|
{ prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.boot' } },
|
||||||
}
|
}
|
||||||
local bootOption = 2
|
local bootOption = 2
|
||||||
|
@ -25,8 +25,8 @@ function Terminal.window(parent, sx, sy, w, h, isVisible)
|
|||||||
width = w,
|
width = w,
|
||||||
height = h,
|
height = h,
|
||||||
isColor = parent.isColor(),
|
isColor = parent.isColor(),
|
||||||
|
offy = 0,
|
||||||
})
|
})
|
||||||
canvas.offy = 0
|
|
||||||
|
|
||||||
win.canvas = canvas
|
win.canvas = canvas
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ function Terminal.window(parent, sx, sy, w, h, isVisible)
|
|||||||
function win.redraw()
|
function win.redraw()
|
||||||
if isVisible then
|
if isVisible then
|
||||||
canvas:dirty()
|
canvas:dirty()
|
||||||
canvas:render(parent)
|
update()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -198,10 +198,12 @@ function Canvas:blit(x, y, text, bg, fg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Canvas:writeLine(y, text, fg, bg)
|
function Canvas:writeLine(y, text, fg, bg)
|
||||||
self.lines[y].dirty = true
|
if y > 0 and y <= #self.lines then
|
||||||
self.lines[y].text = text
|
self.lines[y].dirty = true
|
||||||
self.lines[y].fg = fg
|
self.lines[y].text = text
|
||||||
self.lines[y].bg = bg
|
self.lines[y].fg = fg
|
||||||
|
self.lines[y].bg = bg
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Canvas:clearLine(y, bg, fg)
|
function Canvas:clearLine(y, bg, fg)
|
||||||
|
@ -15,20 +15,12 @@ UI.Checkbox.defaults = {
|
|||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
backgroundFocusColor = colors.lightGray,
|
backgroundFocusColor = colors.lightGray,
|
||||||
height = 1,
|
height = 1,
|
||||||
|
width = 3,
|
||||||
accelerators = {
|
accelerators = {
|
||||||
space = 'checkbox_toggle',
|
space = 'checkbox_toggle',
|
||||||
mouse_click = '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()
|
function UI.Checkbox:draw()
|
||||||
local bg = self.backgroundColor
|
local bg = self.backgroundColor
|
||||||
if self.focused then
|
if self.focused then
|
||||||
|
@ -347,7 +347,7 @@ function Browser:eventHandler(event)
|
|||||||
self:run('cedit', file.name)
|
self:run('cedit', file.name)
|
||||||
|
|
||||||
elseif event.type == 'shell' then
|
elseif event.type == 'shell' then
|
||||||
self:run('sys/apps/shell')
|
self:run('sys/apps/shell.lua')
|
||||||
|
|
||||||
elseif event.type == 'refresh' then
|
elseif event.type == 'refresh' then
|
||||||
self:updateDirectory(self.dir)
|
self:updateDirectory(self.dir)
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
if not _G.requireInjector then
|
-- Lua may be called from outside of shell - inject a require
|
||||||
local BASE ='https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/apis'
|
_G.requireInjector(_ENV)
|
||||||
_ENV.LUA_PATH=BASE .. '/?.lua'
|
|
||||||
load(_G.http.get(BASE .. '/injector.lua').readAll())()(_ENV)
|
|
||||||
end
|
|
||||||
|
|
||||||
local History = require('history')
|
local History = require('history')
|
||||||
local UI = require('ui')
|
local UI = require('ui')
|
||||||
|
@ -424,7 +424,7 @@ function page:eventHandler(event)
|
|||||||
shell.switchTab(shell.openTab(event.button.app.run))
|
shell.switchTab(shell.openTab(event.button.app.run))
|
||||||
|
|
||||||
elseif event.type == 'shell' then
|
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
|
elseif event.type == 'lua' then
|
||||||
shell.switchTab(shell.openTab('sys/apps/Lua.lua'))
|
shell.switchTab(shell.openTab('sys/apps/Lua.lua'))
|
||||||
|
@ -36,7 +36,6 @@ local page = UI.Page {
|
|||||||
description = UI.TextArea {
|
description = UI.TextArea {
|
||||||
x = 16, y = 3, ey = -5,
|
x = 16, y = 3, ey = -5,
|
||||||
marginRight = 0, marginLeft = 0,
|
marginRight = 0, marginLeft = 0,
|
||||||
--backgroundColor = colors.white,
|
|
||||||
},
|
},
|
||||||
load = UI.Button {
|
load = UI.Button {
|
||||||
x = 22, y = -3,
|
x = 22, y = -3,
|
||||||
@ -45,10 +44,8 @@ local page = UI.Page {
|
|||||||
help = 'Download the latest package list',
|
help = 'Download the latest package list',
|
||||||
},
|
},
|
||||||
action = UI.SlideOut {
|
action = UI.SlideOut {
|
||||||
backgroundColor = colors.brown,
|
backgroundColor = colors.cyan,
|
||||||
y = 3,
|
|
||||||
titleBar = UI.TitleBar {
|
titleBar = UI.TitleBar {
|
||||||
backgroundColor = colors.brown,
|
|
||||||
event = 'hide-action',
|
event = 'hide-action',
|
||||||
},
|
},
|
||||||
button = UI.Button {
|
button = UI.Button {
|
||||||
|
@ -314,9 +314,9 @@ function shell.newTab(tabInfo, ...)
|
|||||||
tabInfo.args = args
|
tabInfo.args = args
|
||||||
tabInfo.title = fs.getName(path):match('([^%.]+)')
|
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)
|
table.insert(tabInfo.args, 1, tabInfo.path)
|
||||||
tabInfo.path = 'sys/apps/shell'
|
tabInfo.path = 'sys/apps/shell.lua'
|
||||||
end
|
end
|
||||||
return _ENV.multishell.openTab(tabInfo)
|
return _ENV.multishell.openTab(tabInfo)
|
||||||
end
|
end
|
||||||
@ -329,10 +329,10 @@ function shell.openTab( ... )
|
|||||||
local sCommand = tWords[1]
|
local sCommand = tWords[1]
|
||||||
if sCommand then
|
if sCommand then
|
||||||
local sPath = shell.resolveProgram(sCommand)
|
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))
|
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), sPath, table.unpack(tWords, 2))
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
3
sys/autorun/upgraded.lua
Normal file
3
sys/autorun/upgraded.lua
Normal 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
|
@ -64,7 +64,7 @@ else
|
|||||||
fs.mount('', 'gitfs', GIT_REPO)
|
fs.mount('', 'gitfs', GIT_REPO)
|
||||||
end
|
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
|
if not s then
|
||||||
print('\nError loading Opus OS\n')
|
print('\nError loading Opus OS\n')
|
||||||
|
@ -278,7 +278,7 @@ local function init(...)
|
|||||||
kernel.hook('kernel_ready', function()
|
kernel.hook('kernel_ready', function()
|
||||||
local s, m = kernel.run({
|
local s, m = kernel.run({
|
||||||
title = args[1],
|
title = args[1],
|
||||||
path = 'sys/apps/shell',
|
path = 'sys/apps/shell.lua',
|
||||||
args = args,
|
args = args,
|
||||||
haltOnExit = true,
|
haltOnExit = true,
|
||||||
haltOnError = true,
|
haltOnError = true,
|
||||||
|
@ -46,7 +46,7 @@ local function telnetHost(socket)
|
|||||||
title = 'Telnet client',
|
title = 'Telnet client',
|
||||||
hidden = true,
|
hidden = true,
|
||||||
co = coroutine.create(function()
|
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
|
if socket.queue then
|
||||||
socket:write(socket.queue)
|
socket:write(socket.queue)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user