Comparison

prosodyctl @ 10137:04aea97afee9

prosodyctl: Added the 'get_modules' commands
author João Duarte <jvsDuarte08@gmail.com>
date Tue, 16 Jul 2019 10:05:31 -0700
parent 10135:3ae2809030dd
child 10138:e1ca0d1b5467
comparison
equal deleted inserted replaced
10136:38775965fcd5 10137:04aea97afee9
81 81
82 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; 82 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
83 ----------------------- 83 -----------------------
84 local commands = {}; 84 local commands = {};
85 local command = table.remove(arg, 1); 85 local command = table.remove(arg, 1);
86
87 -- This function receives no arguments. It clones all the plugins from prosody's plugin repository
88 function commands.get_modules(arg)
89 if arg[1] == "--help" then
90 show_usage([[get_modules]], [[Downloads all available modules]]);
91 return 1
92 end
93 if os.execute '[ -e "./downloaded_modules" ]' then
94 print("The modules have already been imported")
95 print("Do you want to re-import?(Y/N)")
96 local answer = io.read()
97 if answer == "Y" then
98 print("Deleting previous imports")
99 os.execute("rm -rf downloaded_modules")
100 print("Downloading plugins")
101 os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules")
102 print("Done!")
103 return 0
104 else
105 print("We keep what we have then!")
106 return 0
107 end
108 else
109 print("Getting all the available modules")
110 os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules")
111 print("Done!")
112 return 0
113 end
114 end
86 115
87 function commands.list(arg) 116 function commands.list(arg)
88 if not arg[1] or arg[1] == "--help" then 117 if not arg[1] or arg[1] == "--help" then
89 show_usage([[list]], [[Shows installed rocks]]); 118 show_usage([[list]], [[Shows installed rocks]]);
90 return 1; 119 return 1;