Comparison

util/prosodyctl.lua @ 11294:a1939b261f67

prosodyctl: Move UI related calls out of util.prosodyctl I think this follows the general separation of duties between prosodyctl and util.prosodyctl better.
author Kim Alvefur <zash@zash.se>
date Thu, 21 Jan 2021 19:04:57 +0100
parent 11292:ad5cd9b0f8de
child 11296:06bb0cdef50b
comparison
equal deleted inserted replaced
11293:cd27ac5e5afe 11294:a1939b261f67
219 219
220 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end) 220 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end)
221 221
222 local function call_luarocks(operation, mod, server) 222 local function call_luarocks(operation, mod, server)
223 local dir = prosody.paths.installer; 223 local dir = prosody.paths.installer;
224 if operation == "install" then
225 show_message("Installing %s in %s", mod, dir);
226 elseif operation == "remove" then
227 show_message("Removing %s from %s", mod, dir);
228 end
229 local ok, where, code = os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod?}", { 224 local ok, where, code = os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod?}", {
230 dir = dir; op = operation; mod = mod; server = server; 225 dir = dir; op = operation; mod = mod; server = server;
231 })); 226 }));
232 if type(ok) == "number" then ok, code = ok == 0, ok; end 227 if type(ok) == "number" then ok, code = ok == 0, ok; end
233 if not ok then 228 if not ok then
234 return code; 229 return code;
235 end
236 if operation == "install" then
237 show_module_configuration_help(mod);
238 end 230 end
239 return true; 231 return true;
240 end 232 end
241 233
242 return { 234 return {