prosodyctl
changeset 10211 4c755c2e6305
parent 10206 d3764eed7ded
child 10214 9fdda9fafc3c
equal deleted inserted replaced
10210:46a5f2bf5ee0 10211:4c755c2e6305
    74 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
    74 local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
    75 local show_usage = prosodyctl.show_usage;
    75 local show_usage = prosodyctl.show_usage;
    76 local show_yesno = prosodyctl.show_yesno;
    76 local show_yesno = prosodyctl.show_yesno;
    77 local show_prompt = prosodyctl.show_prompt;
    77 local show_prompt = prosodyctl.show_prompt;
    78 local read_password = prosodyctl.read_password;
    78 local read_password = prosodyctl.read_password;
    79 local execute_command = prosodyctl.execute_command;
    79 local call_luarocks = prosodyctl.call_luarocks;
    80 
    80 
    81 local jid_split = require "util.jid".prepped_split;
    81 local jid_split = require "util.jid".prepped_split;
    82 
    82 
    83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
    83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
    84 -----------------------
    84 -----------------------
    88 function commands.install(arg)
    88 function commands.install(arg)
    89 	if arg[1] == "--help" then
    89 	if arg[1] == "--help" then
    90 		show_usage([[install]], [[Installs a prosody/luarocks plugin]]);
    90 		show_usage([[install]], [[Installs a prosody/luarocks plugin]]);
    91 		return 1;
    91 		return 1;
    92 	end
    92 	end
    93 	table.insert(arg, "install");
    93 	call_luarocks(arg[1], "install")
    94 	execute_command(arg);
       
    95 end
    94 end
    96 
    95 
    97 function commands.remove(arg)
    96 function commands.remove(arg)
    98 	if arg[1] == "--help" then
    97 	if arg[1] == "--help" then
    99 		show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]);
    98 		show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]);
   100 		return 1;
    99 		return 1;
   101 	end
   100 	end
   102 	table.insert(arg, "remove");
   101 	call_luarocks(arg[1], "remove")
   103 	execute_command(arg);
       
   104 end
   102 end
   105 
   103 
   106 function commands.list(arg)
   104 function commands.list(arg)
   107 	if arg[1] == "--help" then
   105 	if arg[1] == "--help" then
   108 		show_usage([[list]], [[Shows installed rocks]]);
   106 		show_usage([[list]], [[Shows installed rocks]]);
   109 		return 1;
   107 		return 1;
   110 	end
   108 	end
   111 	table.insert(arg, "list");
   109 	call_luarocks(arg[1], "list")
   112 	execute_command(arg);
       
   113 end
   110 end
   114 
   111 
   115 function commands.adduser(arg)
   112 function commands.adduser(arg)
   116 	if not arg[1] or arg[1] == "--help" then
   113 	if not arg[1] or arg[1] == "--help" then
   117 		show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);
   114 		show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);