From f736aec6b2c3062216b6f7481bd80a2444ffc36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 05:01:35 -0700 Subject: prosodyctl: Corrected the remove and install commands' order --- prosodyctl | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/prosodyctl b/prosodyctl index 905e00cf..2fd3084d 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,50 +85,50 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); --- Command to remove a rockspec --- Receives as an argument the name of the plugin to be removed from the plugins folder -function commands.remove(arg) +function commands.install(arg) if arg[1] == "--help" then - show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); + show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end + -- Need to think about the case with many flags 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("=(.+)$") - print("Removing module "..arg[2].." at "..dir) + print("Installing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) + show_module_configuration_help(arg[2]); return 0; else - print("Removing "..arg[1].." from "..prosody.paths.plugins) - os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) - print("Done!") + print("Installing module "..arg[1].." at "..prosody.paths.plugins) + -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from + -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules + os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) + show_module_configuration_help(arg[1]); return 0; end end -function commands.install(arg) +-- Command to remove a rockspec +-- Receives as an argument the name of the plugin to be removed from the plugins folder +function commands.remove(arg) if arg[1] == "--help" then - show_usage([[make]], [[Installs a prosody/luarocks plugin]]); + show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - -- Need to think about the case with many flags 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("=(.+)$") - print("Installing module "..arg[2].." at "..dir) + print("Removing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) - show_module_configuration_help(arg[2]); + os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else - print("Installing module "..arg[1].." at "..prosody.paths.plugins) - -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from - -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules - os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) - show_module_configuration_help(arg[1]); + print("Removing "..arg[1].." from "..prosody.paths.plugins) + os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) + print("Done!") return 0; end end -- cgit v1.2.3