You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CliHelp.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. # $Id: CliHelp.php 1709 2014-11-01 18:05:39Z christian_boltz $
  3. class CliHelp extends Shell {
  4. public $handler_to_use = "__not_set__";
  5. /**
  6. * Show help for this shell.
  7. *
  8. * @access public
  9. */
  10. public function execute() {
  11. $this->help();
  12. }
  13. public function help() {
  14. $handler = new $this->handler_to_use;
  15. # TODO: adjust help text according to $handler->taskNames
  16. $module = preg_replace('/Handler$/', '', $this->handler_to_use);
  17. $module = strtolower($module);
  18. $this->out(
  19. "Usage:
  20. postfixadmin-cli $module <task> [<address>] [--option value]
  21. ");
  22. /*
  23. View $module in interactive mode.
  24. - or -
  25. postfixadmin-cli $module view <address>
  26. View $module <address> in non-interactive mode.
  27. "); */
  28. $head = "Usage: postfixadmin-cli $module <task> [<address>] [--option value] [--option value]\n";
  29. $head .= "-----------------------------------------------\n";
  30. $head .= "Parameters:\n\n";
  31. $commands = array(
  32. 'task' => "\t<task>\n" .
  33. "\t\tAvailable values:\n\n".
  34. "\t\t".sprintf("%-20s %s", "view: ", "View an existing $module.")."\n".
  35. "\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
  36. "\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n".
  37. "\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n",
  38. 'address' => "\t[<address>]\n" .
  39. "\t\tA address of recipient.\n",
  40. );
  41. foreach ($commands as $cmd) {
  42. $this->out("{$cmd}\n\n");
  43. }
  44. }
  45. }
  46. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */