Commit d31658d9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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: http://www.varnish-cache.org/svn/trunk/varnish-cache@2594 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b0b4a338
...@@ -52,8 +52,7 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv) ...@@ -52,8 +52,7 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv)
{ {
struct cli_proto *cp; struct cli_proto *cp;
if (av[2] == NULL) { if (av[2] == NULL || *av[2] == '-') {
cli_out(cli, "Available commands:\n");
for (cp = priv; cp->request != NULL; cp++) for (cp = priv; cp->request != NULL; cp++)
cli_out(cli, "%s\n", cp->syntax); cli_out(cli, "%s\n", cp->syntax);
return; return;
...@@ -64,7 +63,8 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv) ...@@ -64,7 +63,8 @@ cli_func_help(struct cli *cli, const char * const *av, void *priv)
return; return;
} }
} }
cli_param(cli); cli_out(cli, "Unknown request.\nType 'help' for more info.\n");
cli_result(cli, CLIS_UNKNOWN);
} }
void void
...@@ -97,7 +97,7 @@ cli_dispatch(struct cli *cli, struct cli_proto *clp, const char *line) ...@@ -97,7 +97,7 @@ cli_dispatch(struct cli *cli, struct cli_proto *clp, const char *line)
break; break;
if (cp->request == NULL) { if (cp->request == NULL) {
cli_out(cli, cli_out(cli,
"Unknown request, type 'help' for more info.\n"); "Unknown request.\nType 'help' for more info.\n");
cli_result(cli, CLIS_UNKNOWN); cli_result(cli, CLIS_UNKNOWN);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment