# HG changeset patch # User João Duarte # Date 1561140184 -3600 # Node ID 026815f8d832eccf2198db6079cbecb14903e7cd # Parent cb5e4e07ab1145620d8422b44f74d0a41c5f8ff6 prosodyctl: Implemented a command bridge to the 'luarocks-admin add' command, called 'admin_add' diff -r cb5e4e07ab11 -r 026815f8d832 prosodyctl --- a/prosodyctl Fri Jun 21 01:16:18 2019 +0100 +++ b/prosodyctl Fri Jun 21 19:03:04 2019 +0100 @@ -87,7 +87,7 @@ function commands.list(arg) -- Need to think about the case with many flags - local flag="--tree=" + local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") @@ -98,6 +98,22 @@ end end +function commands.admin_add(arg) + local modules, tree, server, refresh = "", "", "", "" + for i, _ in ipairs(arg) do + if arg[i]:sub(1, #"--tree=") == "--tree=" then + tree = arg[i].." " + elseif arg[i]:sub(1, #"--server=") == "--server=" then + server = arg[i].." " + elseif arg[i]:sub(1, #"--no-refresh") == "--no-refresh" then + refresh = arg[i].." " + else + modules=modules..arg[i].." " + end + end + os.execute("luarocks-admin "..tree.."add "..server..refresh..modules) +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module)