Comparison

prosodyctl @ 10126:ad640c2e072e

prosodyctl: Implemented the 'list' command, which is a bridge to 'luarocks list'
author João Duarte <jvsDuarte08@gmail.com>
date Thu, 20 Jun 2019 19:17:47 +0100
parent 10125:58fe5cff5ca2
child 10128:026815f8d832
comparison
equal deleted inserted replaced
10125:58fe5cff5ca2 10126:ad640c2e072e
82 82
83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
84 ----------------------- 84 -----------------------
85 local commands = {}; 85 local commands = {};
86 local command = table.remove(arg, 1); 86 local command = table.remove(arg, 1);
87
88 function commands.list(arg)
89 -- Need to think about the case with many flags
90 local flag="--tree="
91 -- I'm considering the flag is the first, but there can be many flags
92 if arg[1] and arg[1]:sub(1, #flag) == flag then
93 local dir = arg[1]:match("=(.+)$")
94 -- These extra double brackets allow us to correctly process names with spaces
95 os.execute("luarocks list --tree=".."'"..dir.."'")
96 else
97 os.execute("luarocks list --tree="..prosody.paths.data.."/rocks")
98 end
99 end
87 100
88 function commands.enabled_plugins() 101 function commands.enabled_plugins()
89 for module in modulemanager.get_modules_for_host() do 102 for module in modulemanager.get_modules_for_host() do
90 show_warning("%s", module) 103 show_warning("%s", module)
91 end 104 end