diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-01-04 08:37:17 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-01-04 08:37:17 +0200 |
commit | 5c7f75146266ece25a47dc8df898ac1e1629f51d (patch) | |
tree | a7eb9658efb4f5a268cdc5d68e0ee3ac298669b1 /src | |
parent | 82e4f424e9f4ed16f1521c5bd5df31e0f46ce555 (diff) | |
download | pies-5c7f75146266ece25a47dc8df898ac1e1629f51d.tar.gz pies-5c7f75146266ece25a47dc8df898ac1e1629f51d.tar.bz2 |
Improve piesctl help output
* src/piesctl.c (comtab): New members: argdoc and docstr.
(command_help): New function.
(main): Set proginfo.print_help_hook
* po/POTFILES.in: add missing files.
Diffstat (limited to 'src')
-rw-r--r-- | src/piesctl.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/piesctl.c b/src/piesctl.c index b979c09..3ae4af2 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -1526,17 +1526,21 @@ typedef int (*ctlcom_t) (struct shttp_connection *, int, char **); struct comtab { char const *name; + char const *argdoc; + char const *docstr; ctlcom_t command; }; static struct comtab comtab[] = { - { "list", com_list }, - { "stop", com_stop }, - { "start", com_start }, - { "restart", com_restart }, - { "id", com_id }, - { "shutdown", com_shutdown }, - { "reboot", com_reboot }, + { "list", N_("[EXPR]"), N_("list configured components"), com_list }, + { "stop", N_("TAG [TAG...]"), N_("stop components"), com_stop }, + { "start", N_("TAG [TAG...]"), N_("start components"), com_start }, + { "restart", N_("TAG [TAG...]"), N_("restart components"), com_restart }, + { "id", N_("[KEYWORDS...]"), + N_("show info about the running GNU Pies instance"), + com_id }, + { "shutdown", NULL, N_("stop running pies instance"), com_shutdown }, + { "reboot", NULL, N_("restart pies instance"), com_reboot }, { NULL } }; @@ -1577,6 +1581,28 @@ find_command (char const *name) return match; } +static void +command_help (FILE *fp) +{ + struct comtab *cp; + + fputs (_("Available commands are:"), fp); + fputc ('\n', fp); + fputc ('\n', fp); + + for (cp = comtab; cp->name; cp++) + { + fputs (cp->name, fp); + if (cp->argdoc) + { + fputc (' ', fp); + fputs (gettext (cp->argdoc), fp); + } + fputc ('\n', fp); + fprintf (fp, " %s\n", gettext (cp->docstr)); + } + fputc ('\n', fp); +} int main (int argc, char **argv) @@ -1592,7 +1618,8 @@ main (int argc, char **argv) textdomain (PACKAGE); #endif grecs_print_diag_fun = piesctl_diag; - + + proginfo.print_help_hook = command_help; parse_options (argc, argv, &i); argc -= i; argv += i; |