2020-12-28 16:01:41 +00:00
|
|
|
local args={...}
|
|
|
|
local pkg=dofile("/lib/pkgm.lua")
|
2020-12-29 10:30:50 +00:00
|
|
|
local flags={}
|
|
|
|
local ptr=#args
|
|
|
|
while ptr>0 do
|
|
|
|
local c=args[ptr]
|
|
|
|
if c=="-i" or c=="--install-dir" then
|
|
|
|
if args[ptr+1] then
|
|
|
|
flags.install_dir=args[ptr+1]
|
|
|
|
table.remove(args,ptr+1)
|
|
|
|
else
|
|
|
|
error("--install-dir needs an argument")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
ptr=ptr-1
|
|
|
|
end
|
2020-12-28 16:01:41 +00:00
|
|
|
if args[1]=="i" and args[2]~=nil then
|
2020-12-29 10:30:50 +00:00
|
|
|
if flags.install_dir then
|
|
|
|
local s,r=pkg.set_install_dir(flags.install_dir)
|
|
|
|
if not s then error(r) end
|
|
|
|
end
|
2020-12-28 16:01:41 +00:00
|
|
|
local deps=pkg.dependencies(args[2])
|
|
|
|
if not deps then
|
|
|
|
print("Already up to date, æpioform.")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
print("To be installed or updated:\n")
|
|
|
|
print(table.concat(deps," "))
|
|
|
|
print("\nPress the any key to continue.")
|
|
|
|
os.pullEvent("char")
|
|
|
|
pkg.pkginstmulti(deps)
|
|
|
|
print("Done!")
|
|
|
|
elseif args[1]=="rm" and args[2]~=nil then
|
|
|
|
table.remove(args,1)
|
|
|
|
print("If this breaks things, you're completely responsible.")
|
|
|
|
print("Press the any key to continue.")
|
|
|
|
os.pullEvent("char")
|
|
|
|
for i,v in ipairs(args) do
|
|
|
|
pkg.pkguinst(v)
|
|
|
|
end
|
|
|
|
print("Done.")
|
|
|
|
else
|
|
|
|
print("usage:\ni <package>\nupd <package>\nrm <packages>")
|
|
|
|
end
|