Software /
code /
prosody
Comparison
prosodyctl @ 10132:b59535964e81
util.prosodyctl: Moved the 'admin_operation' function from prosodyctl to here
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Tue, 25 Jun 2019 13:20:54 +0100 |
parent | 10131:0780bcf51ba7 |
child | 10133:73bae75c6d77 |
comparison
equal
deleted
inserted
replaced
10131:0780bcf51ba7 | 10132:b59535964e81 |
---|---|
94 -- These extra double brackets allow us to correctly process names with spaces | 94 -- These extra double brackets allow us to correctly process names with spaces |
95 os.execute("luarocks list --tree=".."'"..dir.."'") | 95 os.execute("luarocks list --tree=".."'"..dir.."'") |
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 | |
100 | |
101 function admin_operation(operation, arg) | |
102 local modules, tree, server, refresh = "", "", "", "" | |
103 for i, _ in ipairs(arg) do | |
104 if arg[i]:sub(1, #"--tree=") == "--tree=" then | |
105 tree = arg[i].." " | |
106 elseif arg[i]:sub(1, #"--server=") == "--server=" then | |
107 server = arg[i].." " | |
108 elseif arg[i]:sub(1, #"--no-refresh") == "--no-refresh" then | |
109 refresh = arg[i].." " | |
110 else | |
111 modules=modules..arg[i].." " | |
112 end | |
113 end | |
114 os.execute("luarocks-admin "..tree..operation..server..refresh..modules) | |
115 end | 99 end |
116 | 100 |
117 function commands.admin_add(arg) | 101 function commands.admin_add(arg) |
118 admin_operation("add ", arg) | 102 admin_operation("add ", arg) |
119 end | 103 end |