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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. # $Id$
  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. /*
  24. View $module in interactive mode.
  25. - or -
  26. postfixadmin-cli $module view <address>
  27. View $module <address> in non-interactive mode.
  28. "); */
  29. $head = "Usage: postfixadmin-cli $module <task> [<address>] [--option value] [--option value]\n";
  30. $head .= "-----------------------------------------------\n";
  31. $head .= "Parameters:\n\n";
  32. $commands = array(
  33. 'task' => "\t<task>\n" .
  34. "\t\tAvailable values:\n\n".
  35. "\t\t".sprintf("%-20s %s", "view: ", "View an existing $module.")."\n".
  36. "\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
  37. "\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n".
  38. "\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n",
  39. 'address' => "\t[<address>]\n" .
  40. "\t\tA address of recipient.\n",
  41. );
  42. foreach ($commands as $cmd) {
  43. $this->out("{$cmd}\n\n");
  44. }
  45. }
  46. }
  47. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */