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