aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-06-20 19:17:47 +0100
committerJoão Duarte <jvsDuarte08@gmail.com>2019-06-20 19:17:47 +0100
commit992d18aa62af23bbb5849e728a9b298b556e2cb0 (patch)
tree1955e014a715986c2a0c8145121f4876d40e046c /prosodyctl
parent8025f98427a23a64f3dd303aedde6fcc8d5ea688 (diff)
downloadprosody-992d18aa62af23bbb5849e728a9b298b556e2cb0.tar.gz
prosody-992d18aa62af23bbb5849e728a9b298b556e2cb0.zip
prosodyctl: Implemented the 'list' command, which is a bridge to 'luarocks list'
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl13
1 files changed, 13 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index a7300973..d726c028 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -85,6 +85,19 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) *
local commands = {};
local command = table.remove(arg, 1);
+function commands.list(arg)
+ -- 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("=(.+)$")
+ -- These extra double brackets allow us to correctly process names with spaces
+ os.execute("luarocks list --tree=".."'"..dir.."'")
+ else
+ os.execute("luarocks list --tree="..prosody.paths.data.."/rocks")
+ end
+end
+
function commands.enabled_plugins()
for module in modulemanager.get_modules_for_host() do
show_warning("%s", module)