Software /
code /
prosody
Comparison
prosodyctl @ 2706:c2dde8bda3fe
prosodyctl: Fix addplugin to support --help, and hide from the help listing (for now)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Feb 2010 01:48:07 +0000 |
parent | 2705:8a5af6f14c07 |
child | 3013:518e3f6f9946 |
child | 3233:8f78e8164032 |
comparison
equal
deleted
inserted
replaced
2705:8a5af6f14c07 | 2706:c2dde8bda3fe |
---|---|
502 local http_errors = { | 502 local http_errors = { |
503 [404] = "Plugin not found, did you type the address correctly?" | 503 [404] = "Plugin not found, did you type the address correctly?" |
504 }; | 504 }; |
505 | 505 |
506 function commands.addplugin(arg) | 506 function commands.addplugin(arg) |
507 if not arg[1] or arg[1] == "--help" then | |
508 show_usage("addplugin URL", "Download and install a plugin from a URL"); | |
509 return 1; | |
510 end | |
507 local url = arg[1]; | 511 local url = arg[1]; |
508 if url:match("^http://") then | 512 if url:match("^http://") then |
509 local http = require "socket.http"; | 513 local http = require "socket.http"; |
510 show_message("Fetching..."); | 514 show_message("Fetching..."); |
511 local code, err = http.request(url); | 515 local code, err = http.request(url); |
573 print(""); | 577 print(""); |
574 print("Usage: "..arg[0].." COMMAND [OPTIONS]"); | 578 print("Usage: "..arg[0].." COMMAND [OPTIONS]"); |
575 print(""); | 579 print(""); |
576 print("Where COMMAND may be one of:\n"); | 580 print("Where COMMAND may be one of:\n"); |
577 | 581 |
578 local hidden_commands = require "util.set".new{ "register", "unregister" }; | 582 local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; |
579 local commands_order = { "adduser", "passwd", "deluser" }; | 583 local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart" }; |
580 | 584 |
581 local done = {}; | 585 local done = {}; |
582 | 586 |
583 for _, command_name in ipairs(commands_order) do | 587 for _, command_name in ipairs(commands_order) do |
584 local command = commands[command_name]; | 588 local command = commands[command_name]; |