added repository managment app

This commit is contained in:
2026-01-02 14:35:00 -08:00
parent fda51af6a0
commit bb81d3122b
3 changed files with 93 additions and 1 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.containerizer .containerizer
/Launcher/build /Launcher/build
/Software/build /Software/build
/Repos/build

25
Repos/build.lua Normal file
View File

@@ -0,0 +1,25 @@
--Default build.lua Script
local appid = "org.ruffles.repos"
local project_name = "Repos"
local package_data = build.optimize(build.package("src"))
build.writePackage(package_data,"build/"..appid)
local meta = {
perms = {
repo = true,
network = false,
app = false,
http = false,
},
author = "Ruffles",
name = project_name,
appid = appid,
}
build.writeMeta(meta,"build/"..project_name..".meta")
build.merge("build/"..appid,"build/"..project_name..".meta","build/"..project_name..".app")

66
Repos/src/startup.lua Normal file
View File

@@ -0,0 +1,66 @@
local w,h = term.getSize()
local scroll = 0
local selected = 1
local do_render = true
local map_to_id = {}
local function render()
while true do
if do_render then
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
term.clear()
local repos = repo.getRepos()
local ypos = 1
map_to_id = {}
for k,v in pairs(repos) do
map_to_id[ypos] = k
term.setCursorPos(1,ypos+scroll)
if ypos == selected then
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
else
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
end
term.clearLine()
term.write(tostring(k).." "..tostring(v))
ypos = ypos + 1
end
end
sleep(1/20)
end
end
local function input()
while true do
local event = {os.pullEvent()}
if event[1] == "mouse_scroll" then
scroll = math.max(math.min(0,scroll-event[2]),-math.max(0,#map_to_id-1))
elseif event[1] == "key_up" then
if event[2] == keys["a"] then
do_render = false
term.setBackgroundColor(colors.lightGray)
term.setCursorPos(1,(h/2)+1)
term.clearLine()
term.setCursorPos(1,(h/2)-1)
term.clearLine()
term.setBackgroundColor(colors.gray)
term.setCursorPos(1,h/2)
term.clearLine()
local id = tonumber(read())
if id and id >= 0 then
repo.addRepo(id)
end
term.setBackgroundColor(colors.black)
do_render = true
elseif event[2] == keys["d"] then
if map_to_id[selected] then
repo.rmRepo(map_to_id[selected])
end
end
elseif event[1] == "mouse_click" then
selected = event[4]-scroll
end
end
end
parallel.waitForAny(input,render)