0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
postfixadmin/model/CliHelp.php

67 lines
1.8 KiB
PHP
Raw Normal View History

<?php
2022-06-28 14:46:11 +02:00
2018-01-26 15:45:57 +01:00
# $Id$
2021-03-22 10:28:28 +01:00
class CliHelp extends Shell
{
public $handler_to_use = "__not_set__";
2018-01-26 15:45:57 +01:00
/**
* Show help for this shell.
*
* @access public
*/
2021-04-13 22:19:16 +02:00
public function execute()
{
$this->help();
}
2021-04-13 22:19:16 +02:00
public function help()
{
2022-06-28 14:46:11 +02:00
$handler = new $this->handler_to_use();
# TODO: adjust help text according to $handler->taskNames
$module = preg_replace('/Handler$/', '', $this->handler_to_use);
$module = strtolower($module);
$this->out(
2022-07-15 11:29:55 +02:00
"Usage:
postfixadmin-cli $module <task> [<address>] [--option value]
2018-01-26 15:45:57 +01:00
"
);
/*
View $module in interactive mode.
2018-01-26 15:45:57 +01:00
- or -
2018-01-26 15:45:57 +01:00
postfixadmin-cli $module view <address>
2018-01-26 15:45:57 +01:00
View $module <address> in non-interactive mode.
"); */
2022-06-28 14:46:11 +02:00
$head = "Usage: postfixadmin-cli $module <task> [<address>] [--option value] [--option value]\n";
$head .= "-----------------------------------------------\n";
$head .= "Parameters:\n\n";
$commands = array(
'task' => "\t<task>\n" .
"\t\tAvailable values:\n\n".
"\t\t".sprintf("%-20s %s", "view: ", "View an existing $module.")."\n".
"\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
2018-01-26 15:45:57 +01:00
"\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n".
"\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n",
'address' => "\t[<address>]\n" .
"\t\tA address of recipient.\n",
);
foreach ($commands as $cmd) {
$this->out("{$cmd}\n\n");
}
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */