1
0
Fork 0
mirror of https://github.com/bjc/prosody.git synced 2025-04-06 06:37:37 +03:00

util.prosodyctl: Moved the 'admin_operation' function from prosodyctl to here

This commit is contained in:
João Duarte 2019-06-25 13:20:54 +01:00
parent 2aa2aff974
commit 122bde2f2c
2 changed files with 17 additions and 16 deletions

View file

@ -278,6 +278,22 @@ local function reload()
return true;
end
local function admin_operation(operation, arg)
local modules, tree, server, refresh = "", "", "", ""
for i, _ in ipairs(arg) do
if arg[i]:sub(1, #"--tree=") == "--tree=" then
tree = arg[i].." "
elseif arg[i]:sub(1, #"--server=") == "--server=" then
server = arg[i].." "
elseif arg[i]:sub(1, #"--no-refresh") == "--no-refresh" then
refresh = arg[i].." "
else
modules=modules..arg[i].." "
end
end
os.execute("luarocks-admin "..tree..operation..server..refresh..modules)
end
return {
show_message = show_message;
show_warning = show_message;
@ -297,4 +313,5 @@ return {
start = start;
stop = stop;
reload = reload;
admin_operation = admin_operation;
};