aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-06-21 19:03:04 +0100
committerJoão Duarte <jvsDuarte08@gmail.com>2019-06-21 19:03:04 +0100
commit1fda45e5860bbfd748ec163b4f7ebe03d1ba7c7e (patch)
tree40b72f7220f2c7e8bddf58906965a9292b27dc19
parent4a60619f5d01c0306f4ddac8dcc6faf5aeb58e7d (diff)
downloadprosody-1fda45e5860bbfd748ec163b4f7ebe03d1ba7c7e.tar.gz
prosody-1fda45e5860bbfd748ec163b4f7ebe03d1ba7c7e.zip
prosodyctl: Implemented a command bridge to the 'luarocks-admin add' command, called 'admin_add'
-rwxr-xr-xprosodyctl18
1 files changed, 17 insertions, 1 deletions
diff --git a/prosodyctl b/prosodyctl
index d726c028..efe6394e 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -87,7 +87,7 @@ local command = table.remove(arg, 1);
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 @@ function commands.list(arg)
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)