r2594 - trunk/varnish-cache/lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Wed Mar 12 11:21:51 CET 2008


Author: phk
Date: 2008-03-12 11:21:49 +0100 (Wed, 12 Mar 2008)
New Revision: 2594

Modified:
   trunk/varnish-cache/lib/libvarnish/cli.c
Log:
Change the default cli help function to ignore options starting
with '-'.

Remove header line.

If argument is not found, return CLIS_UNKNOWN.


Modified: trunk/varnish-cache/lib/libvarnish/cli.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/cli.c	2008-03-11 11:25:28 UTC (rev 2593)
+++ trunk/varnish-cache/lib/libvarnish/cli.c	2008-03-12 10:21:49 UTC (rev 2594)
@@ -52,8 +52,7 @@
 {
 	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 @@
 			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 @@
 				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;
 		}




More information about the varnish-commit mailing list