diff options
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | src/piesctl.c | 43 |
2 files changed, 37 insertions, 8 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index e075bea..f696480 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -29,6 +29,8 @@ src/socket.c lib/url.c src/userprivs.c src/piesctl.c +src/cmdline.h +src/piesctl-cl.h lib/parsetime.c lib/proctitle.c 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; |