diff --git a/lib/lum.lua b/lib/lum.lua index 546b174..7f07fbe 100644 --- a/lib/lum.lua +++ b/lib/lum.lua @@ -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 \ No newline at end of file diff --git a/lum.lua b/lum.lua index f16d4fe..ad5b69c 100644 --- a/lum.lua +++ b/lum.lua @@ -4,6 +4,7 @@ local action = args[1] if action == "install" then package = args[2] + if package == nil then print("Usage: lum install ") return