aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-07-17 09:03:15 -0700
committerJoão Duarte <jvsDuarte08@gmail.com>2019-07-17 09:03:15 -0700
commitefb9164e517ff5d95a6b82fd3cf416535b2fe3af (patch)
tree7eeff70e542e3a8f5b48abbb497dfc4ee49673ac /prosodyctl
parent213539ccd90da28856875c64bd41868cb818f2f9 (diff)
downloadprosody-efb9164e517ff5d95a6b82fd3cf416535b2fe3af.tar.gz
prosody-efb9164e517ff5d95a6b82fd3cf416535b2fe3af.zip
prosodyctl: Improved the 'remove' command
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl18
1 files changed, 14 insertions, 4 deletions
diff --git a/prosodyctl b/prosodyctl
index a1dd1614..af1fea54 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -147,10 +147,20 @@ function commands.remove(arg)
show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]);
return 1
end
- print("Removing "..arg[1].." from ./plugins")
- os.execute("luarocks --tree='./plugins' remove "..arg[1])
- print("Done!")
- return 0
+ 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..", from luarocks repo")
+ -- These extra double brackets allow us to correctly process names with spaces
+ os.execute("luarocks remove --tree='"..dir.."' "..arg[2])
+ return 0;
+ else
+ print("Removing "..arg[1].." from ./plugins")
+ os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1])
+ print("Done!")
+ return 0
+ end
end
function commands.install(arg)