Comparison

prosodyctl @ 10124:5a3611218709

prosodyctl: Added the 'local_plugins' command function, which prints back a list of locally available plugins
author João Duarte <jvsDuarte08@gmail.com>
date Fri, 07 Jun 2019 13:00:40 +0100
parent 10123:5d132d4aac55
child 10125:58fe5cff5ca2
comparison
equal deleted inserted replaced
10123:5d132d4aac55 10124:5a3611218709
85 local commands = {}; 85 local commands = {};
86 local command = table.remove(arg, 1); 86 local command = table.remove(arg, 1);
87 87
88 function commands.test() 88 function commands.test()
89 show_message [[Well, hello there!]] 89 show_message [[Well, hello there!]]
90 --show_message [[Enabled Plugins: ], modulemanager.get_modules_for_host()]
91 show_warning("Trying to peek at the plugin directory: '%s'", modulemanager.get_modules_for_host()) 90 show_warning("Trying to peek at the plugin directory: '%s'", modulemanager.get_modules_for_host())
91 end
92
93 function commands.local_plugins()
94 local directory = "./plugins"
95 local i, t, popen = 0, {}, io.popen
96 local pfile = popen('ls -a "'..directory..'"')
97 for filename in pfile:lines() do
98 if filename == "." or filename == ".." then
99 i = i + 1
100 else
101 i = i + 1
102 t[i] = filename
103 show_warning("%s", t[i])
104 end
105 end
106 pfile:close()
92 end 107 end
93 108
94 function commands.adduser(arg) 109 function commands.adduser(arg)
95 if not arg[1] or arg[1] == "--help" then 110 if not arg[1] or arg[1] == "--help" then
96 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); 111 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);