Comparison

prosodyctl @ 10129:406afedc9375

prosodyctl: Changed the command 'admin_add' to 'admin_operation', which will be called by both add/remove operations
author João Duarte <jvsDuarte08@gmail.com>
date Tue, 25 Jun 2019 00:52:12 +0100
parent 10128:026815f8d832
child 10130:667f37603308
comparison
equal deleted inserted replaced
10128:026815f8d832 10129:406afedc9375
96 else 96 else
97 os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") 97 os.execute("luarocks list --tree="..prosody.paths.data.."/rocks")
98 end 98 end
99 end 99 end
100 100
101 function commands.admin_add(arg) 101 function admin_operation(operation, arg)
102 local modules, tree, server, refresh = "", "", "", "" 102 local modules, tree, server, refresh = "", "", "", ""
103 for i, _ in ipairs(arg) do 103 for i, _ in ipairs(arg) do
104 if arg[i]:sub(1, #"--tree=") == "--tree=" then 104 if arg[i]:sub(1, #"--tree=") == "--tree=" then
105 tree = arg[i].." " 105 tree = arg[i].." "
106 elseif arg[i]:sub(1, #"--server=") == "--server=" then 106 elseif arg[i]:sub(1, #"--server=") == "--server=" then
109 refresh = arg[i].." " 109 refresh = arg[i].." "
110 else 110 else
111 modules=modules..arg[i].." " 111 modules=modules..arg[i].." "
112 end 112 end
113 end 113 end
114 os.execute("luarocks-admin "..tree.."add "..server..refresh..modules) 114 os.execute("luarocks-admin "..tree..operation..server..refresh..modules)
115 end 115 end
116 116
117 function commands.enabled_plugins() 117 function commands.enabled_plugins()
118 for module in modulemanager.get_modules_for_host() do 118 for module in modulemanager.get_modules_for_host() do
119 show_warning("%s", module) 119 show_warning("%s", module)