aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-07-17 03:45:26 -0700
committerJoão Duarte <jvsDuarte08@gmail.com>2019-07-17 03:45:26 -0700
commit213539ccd90da28856875c64bd41868cb818f2f9 (patch)
treeeb9eec48bd8c84b3ee16246b23784a76378ffb5c
parent184b2a45b80a03728038643d0c5ec1cfd70e617f (diff)
downloadprosody-213539ccd90da28856875c64bd41868cb818f2f9.tar.gz
prosody-213539ccd90da28856875c64bd41868cb818f2f9.zip
prosodyctl: The 'install' command can now recognize the flag '--tree'
-rwxr-xr-xprosodyctl17
1 files changed, 14 insertions, 3 deletions
diff --git a/prosodyctl b/prosodyctl
index 750c84e4..a1dd1614 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -158,9 +158,20 @@ function commands.install(arg)
show_usage([[make]], [[Installs a rockspec/rock from a specified server]]);
return 1
end
- print("Installing module "..arg[1].." locally, from luarocks repo")
- os.execute("luarocks --tree='./plugins' install "..arg[1])
- return 0
+ -- 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..", from luarocks repo")
+ -- These extra double brackets allow us to correctly process names with spaces
+ os.execute("luarocks install --tree='"..dir.."' "..arg[2])
+ return 0;
+ else
+ print("Installing module "..arg[1].." locally, from luarocks repo")
+ os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1])
+ return 0
+ end
end
function commands.list(arg)