Comparison

prosodyctl @ 11293:cd27ac5e5afe

prosodyctl: Use luarocks status code as exit code Enables some shell level error handling
author Kim Alvefur <zash@zash.se>
date Thu, 21 Jan 2021 19:02:03 +0100
parent 11247:4e803e80d7b1
child 11294:a1939b261f67
comparison
equal deleted inserted replaced
11292:ad5cd9b0f8de 11293:cd27ac5e5afe
77 if arg[1] == "--help" then 77 if arg[1] == "--help" then
78 show_usage([[install]], [[Installs a prosody/luarocks plugin]]); 78 show_usage([[install]], [[Installs a prosody/luarocks plugin]]);
79 return 1; 79 return 1;
80 end 80 end
81 -- TODO finalize config option name 81 -- TODO finalize config option name
82 call_luarocks("install", arg[1], configmanager.get("*", "plugin_server") or "http://localhost/"); 82 local ret = call_luarocks("install", arg[1], configmanager.get("*", "plugin_server") or "http://localhost/");
83 return ret;
83 end 84 end
84 85
85 function commands.remove(arg) 86 function commands.remove(arg)
86 if arg[1] == "--help" then 87 if arg[1] == "--help" then
87 show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]); 88 show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]);
88 return 1; 89 return 1;
89 end 90 end
90 call_luarocks("remove", arg[1]) 91 local ret = call_luarocks("remove", arg[1]);
92 return ret;
91 end 93 end
92 94
93 function commands.list(arg) 95 function commands.list(arg)
94 if arg[1] == "--help" then 96 if arg[1] == "--help" then
95 show_usage([[list]], [[Shows installed rocks]]); 97 show_usage([[list]], [[Shows installed rocks]]);
96 return 1; 98 return 1;
97 end 99 end
98 call_luarocks("list", arg[1]) 100 local ret = call_luarocks("list", arg[1]);
101 return ret;
99 end 102 end
100 103
101 function commands.adduser(arg) 104 function commands.adduser(arg)
102 if not arg[1] or arg[1] == "--help" then 105 if not arg[1] or arg[1] == "--help" then
103 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); 106 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);