Software / code / prosody
Comparison
prosodyctl @ 13609:c0b6b6a12228
prosodyctl: 'about' becomes 'version -v', 'version' prints only version
The 'about' command remains for backwards compatibility, but hidden.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 08 Jan 2025 20:35:05 +0000 |
| parent | 13606:6127b51803bb |
| child | 13610:ff0f4d1f16c8 |
comparison
equal
deleted
inserted
replaced
| 13608:df32fff0963d | 13609:c0b6b6a12228 |
|---|---|
| 471 print(name..":"..string.rep(" ", longest_name-#name), version); | 471 print(name..":"..string.rep(" ", longest_name-#name), version); |
| 472 end | 472 end |
| 473 print(""); | 473 print(""); |
| 474 end | 474 end |
| 475 | 475 |
| 476 function commands.version(arg) | |
| 477 local flags = { short_params = { h = "help"; ["?"] = "help", v = "verbose" } }; | |
| 478 local opts = parse_args(arg, flags); | |
| 479 if opts.help then | |
| 480 show_usage("version [-v]", [[Show current Prosody version, or more]]); | |
| 481 return 0; | |
| 482 elseif opts.verbose then | |
| 483 return commands.about(arg); | |
| 484 end | |
| 485 | |
| 486 print("Prosody "..(prosody.version or "(unknown version)")); | |
| 487 end | |
| 488 | |
| 476 function commands.reload(arg) | 489 function commands.reload(arg) |
| 477 local opts = parse_args(arg, only_help); | 490 local opts = parse_args(arg, only_help); |
| 478 if opts.help then | 491 if opts.help then |
| 479 show_usage([[reload]], [[Reload Prosody's configuration and re-open log files]]); | 492 show_usage([[reload]], [[Reload Prosody's configuration and re-open log files]]); |
| 480 return 0; | 493 return 0; |
| 616 end | 629 end |
| 617 end | 630 end |
| 618 | 631 |
| 619 if not commands[command] then -- Show help for all commands | 632 if not commands[command] then -- Show help for all commands |
| 620 function show_usage(usage, desc) | 633 function show_usage(usage, desc) |
| 621 print(string.format(" %-11s %s", usage, desc)); | 634 print(string.format(" %-14s %s", usage, desc)); |
| 622 end | 635 end |
| 623 | 636 |
| 624 print("prosodyctl - Manage a Prosody server"); | 637 print("prosodyctl - Manage a Prosody server"); |
| 625 print(""); | 638 print(""); |
| 626 print("Usage: "..arg[0].." COMMAND [OPTIONS]"); | 639 print("Usage: "..arg[0].." COMMAND [OPTIONS]"); |
| 635 "User management:", | 648 "User management:", |
| 636 "adduser"; "passwd"; "deluser"; | 649 "adduser"; "passwd"; "deluser"; |
| 637 "Plugin management:", | 650 "Plugin management:", |
| 638 "install"; "remove"; "list"; | 651 "install"; "remove"; "list"; |
| 639 "Informative:", | 652 "Informative:", |
| 640 "about", | |
| 641 "check", | 653 "check", |
| 654 "version", | |
| 642 "Other:", | 655 "Other:", |
| 643 "cert", | 656 "cert", |
| 644 }; | 657 }; |
| 645 -- These live in util.prosodyctl.$command so we have their short help here. | 658 -- These live in util.prosodyctl.$command so we have their short help here. |
| 646 local external_commands = { | 659 local external_commands = { |