]> err.no Git - varnish/commitdiff
Change the default cli help function to ignore options starting
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 12 Mar 2008 10:21:49 +0000 (10:21 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 12 Mar 2008 10:21:49 +0000 (10:21 +0000)
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

varnish-cache/lib/libvarnish/cli.c

index 7827d34a60a33e07aac35531d00675419b0d54a3..1690d2a623a1f3741b889728e5a7e4753b2af2bc 100644 (file)
@@ -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;
                }