mirror of
https://github.com/kepler155c/opus
synced 2024-12-29 01:50:27 +00:00
package manager improvements
This commit is contained in:
parent
9456d31881
commit
0b222207ba
@ -33,6 +33,12 @@ local page = UI.Page {
|
||||
operationText = 'Remove',
|
||||
help = 'Remove',
|
||||
},
|
||||
updateall = UI.Button {
|
||||
ex = -2, y = -3, width = 12,
|
||||
text = 'Update All',
|
||||
event = 'updateall',
|
||||
help = 'Update all installed packages',
|
||||
},
|
||||
description = UI.TextArea {
|
||||
x = 16, y = 3, ey = -5,
|
||||
marginRight = 0, marginLeft = 0,
|
||||
@ -138,6 +144,13 @@ function page:eventHandler(event)
|
||||
self.description:draw()
|
||||
self:updateSelection(event.selected)
|
||||
|
||||
elseif event.type == 'updateall' then
|
||||
self.operation = 'updateall'
|
||||
self.action.button.text = ' Begin '
|
||||
self.action.button.event = 'begin'
|
||||
self.action.titleBar.title = 'Update All'
|
||||
self.action:show()
|
||||
|
||||
elseif event.type == 'action' then
|
||||
local selected = self.grid:getSelected()
|
||||
if selected then
|
||||
@ -153,11 +166,16 @@ function page:eventHandler(event)
|
||||
self.action:hide()
|
||||
|
||||
elseif event.type == 'begin' then
|
||||
local selected = self.grid:getSelected()
|
||||
self:run(self.operation, selected.name)
|
||||
selected.installed = Packages:isInstalled(selected.name)
|
||||
if self.operation == 'updateall' then
|
||||
self:run(self.operation, '')
|
||||
else
|
||||
local selected = self.grid:getSelected()
|
||||
self:run(self.operation, selected.name)
|
||||
selected.installed = Packages:isInstalled(selected.name)
|
||||
|
||||
self:updateSelection(selected)
|
||||
end
|
||||
|
||||
self:updateSelection(selected)
|
||||
self.action.button.text = ' Done '
|
||||
self.action.button.event = 'hide-action'
|
||||
self.action.button:draw()
|
||||
|
@ -25,7 +25,10 @@ Anavrins: Encryption/security/custom apps
|
||||
Community: Several selected applications
|
||||
hugeblank: Startup screen improvements
|
||||
LDDestroier: Art design + custom apps
|
||||
Lemmmy: Application improvements]]
|
||||
Lemmmy: Application improvements
|
||||
|
||||
%sContribute at:%s
|
||||
https://github.com/kepler155c/opus]]
|
||||
|
||||
local page = UI.Page {
|
||||
wizard = UI.Wizard {
|
||||
@ -108,7 +111,7 @@ local page = UI.Page {
|
||||
textColor = colors.yellow,
|
||||
inactive = true,
|
||||
x = 3, ex = -3, y = 2, ey = -2,
|
||||
value = string.format(contributorsIntro, Ansi.white),
|
||||
value = string.format(contributorsIntro, Ansi.white, Ansi.yellow, Ansi.white),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -35,13 +35,15 @@ local function progress(max)
|
||||
end
|
||||
end
|
||||
|
||||
local function install(name, isUpdate)
|
||||
local function install(name, isUpdate, ignoreDeps)
|
||||
local manifest = Packages:downloadManifest(name) or error('Invalid package')
|
||||
|
||||
if manifest.required then
|
||||
for _, v in pairs(manifest.required) do
|
||||
if isUpdate or not Packages:isInstalled(v) then
|
||||
install(v, isUpdate)
|
||||
if not ignoreDeps then
|
||||
if manifest.required then
|
||||
for _, v in pairs(manifest.required) do
|
||||
if isUpdate or not Packages:isInstalled(v) then
|
||||
install(v, isUpdate)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -89,6 +91,21 @@ if action == 'install' then
|
||||
return
|
||||
end
|
||||
|
||||
if action == 'refresh' then
|
||||
print('Downloading...')
|
||||
Packages:downloadList()
|
||||
print('refresh complete')
|
||||
return
|
||||
end
|
||||
|
||||
if action == 'updateall' then
|
||||
for name in pairs(Packages:installed()) do
|
||||
install(name, true, true)
|
||||
end
|
||||
print('updateall complete')
|
||||
return
|
||||
end
|
||||
|
||||
if action == 'update' then
|
||||
local name = args[1] or Syntax('Invalid package')
|
||||
if not Packages:isInstalled(name) then
|
||||
|
@ -17,6 +17,6 @@ end
|
||||
_ENV.shell.setCompletionFunction("sys/apps/package.lua",
|
||||
function(_, index, text)
|
||||
if index == 1 then
|
||||
return completeMultipleChoice(text, { "install ", "update ", "uninstall " })
|
||||
return completeMultipleChoice(text, { "install ", "update ", "uninstall ", "updateall ", "refresh" })
|
||||
end
|
||||
end)
|
||||
|
@ -5,12 +5,6 @@ local fs = _G.fs
|
||||
local help = _G.help
|
||||
local shell = _ENV.shell
|
||||
|
||||
if not fs.exists('usr/config/packages') then
|
||||
pcall(function()
|
||||
Packages:downloadList()
|
||||
end)
|
||||
end
|
||||
|
||||
local appPaths = Util.split(shell.path(), '(.-):')
|
||||
local helpPaths = Util.split(help.path(), '(.-):')
|
||||
|
||||
|
@ -21,6 +21,9 @@ function Packages:installed()
|
||||
end
|
||||
|
||||
function Packages:list()
|
||||
if not fs.exists('usr/config/packages') then
|
||||
self:downloadList()
|
||||
end
|
||||
return Util.readTable('usr/config/packages') or { }
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user