aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-07-16 10:05:31 -0700
committerJoão Duarte <jvsDuarte08@gmail.com>2019-07-16 10:05:31 -0700
commit7c291a6e154b0325ca4173995810f7b0831f7480 (patch)
treece551f3773d971efaaafccc098ec040f6107511d
parent7555016ac24cb681b2c443324652a5cc9df61799 (diff)
downloadprosody-7c291a6e154b0325ca4173995810f7b0831f7480.tar.gz
prosody-7c291a6e154b0325ca4173995810f7b0831f7480.zip
prosodyctl: Added the 'get_modules' commands
-rwxr-xr-xprosodyctl29
1 files changed, 29 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index 7cae908e..0bde4478 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -84,6 +84,35 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) *
local commands = {};
local command = table.remove(arg, 1);
+-- This function receives no arguments. It clones all the plugins from prosody's plugin repository
+function commands.get_modules(arg)
+ if arg[1] == "--help" then
+ show_usage([[get_modules]], [[Downloads all available modules]]);
+ return 1
+ end
+ if os.execute '[ -e "./downloaded_modules" ]' then
+ print("The modules have already been imported")
+ print("Do you want to re-import?(Y/N)")
+ local answer = io.read()
+ if answer == "Y" then
+ print("Deleting previous imports")
+ os.execute("rm -rf downloaded_modules")
+ print("Downloading plugins")
+ os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules")
+ print("Done!")
+ return 0
+ else
+ print("We keep what we have then!")
+ return 0
+ end
+ else
+ print("Getting all the available modules")
+ os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules")
+ print("Done!")
+ return 0
+ end
+end
+
function commands.list(arg)
if not arg[1] or arg[1] == "--help" then
show_usage([[list]], [[Shows installed rocks]]);