From: phk Date: Wed, 12 Mar 2008 10:21:49 +0000 (+0000) Subject: Change the default cli help function to ignore options starting X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ff81c1ddb777b023173e814e127f69cad4021a;p=varnish Change the default cli help function to ignore options starting with '-'. Remove header line. If argument is not found, return CLIS_UNKNOWN. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2594 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnish/cli.c b/varnish-cache/lib/libvarnish/cli.c index 7827d34a..1690d2a6 100644 --- a/varnish-cache/lib/libvarnish/cli.c +++ b/varnish-cache/lib/libvarnish/cli.c @@ -52,8 +52,7 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv) { struct cli_proto *cp; - if (av[2] == NULL) { - cli_out(cli, "Available commands:\n"); + if (av[2] == NULL || *av[2] == '-') { for (cp = priv; cp->request != NULL; cp++) cli_out(cli, "%s\n", cp->syntax); return; @@ -64,7 +63,8 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv) return; } } - cli_param(cli); + cli_out(cli, "Unknown request.\nType 'help' for more info.\n"); + cli_result(cli, CLIS_UNKNOWN); } void @@ -97,7 +97,7 @@ cli_dispatch(struct cli *cli, struct cli_proto *clp, const char *line) break; if (cp->request == NULL) { cli_out(cli, - "Unknown request, type 'help' for more info.\n"); + "Unknown request.\nType 'help' for more info.\n"); cli_result(cli, CLIS_UNKNOWN); break; }