iteration

This commit is contained in:
Layla 2023-10-09 07:14:14 -04:00
parent 7aad0ba0e1
commit c3d3fefd08
2 changed files with 22 additions and 2 deletions

View File

@ -36,10 +36,29 @@ end
function install(package)
io.write("Installing " .. package .. "\n")
download_lua("packages/" .. package .. ".lua", bin_path .. package .. ".lua")
local dir = bin_path
--if package starts with lib then remove lib
if string.sub(package, 1, 3) == "lib" then
package = string.sub(package, 5)
dir = lib_path
end
download_lua("packages/" .. package .. ".lua", dir .. package .. ".lua")
if dir == lib_path then
os.loadAPI(lib_path .. package .. ".lua")
end
end
function remove(package)
io.write("Removing " .. package .. "\n")
fs.delete(bin_path .. package .. ".lua")
local dir = bin_path
--if package starts with lib then remove lib
if string.sub(package, 1, 3) == "lib" then
package = string.sub(package, 5)
dir = lib_path
end
fs.delete(dir .. package .. ".lua")
end

View File

@ -4,6 +4,7 @@ local action = args[1]
if action == "install" then
package = args[2]
if package == nil then
print("Usage: lum install <package>")
return