From: Olivier Houchard Date: Mon, 25 Nov 2024 17:34:01 +0000 (+0100) Subject: MINOR: cli: Add a "help" keyword to show sess X-Git-Tag: v3.1.0~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5288d0f47b165cf4dbeb0794606ecffa3c356a3b;p=thirdparty%2Fhaproxy.git MINOR: cli: Add a "help" keyword to show sess Add a help keyword to show sess, that will provide a longer explanation of all the available options than what is provided by the command "help". --- diff --git a/src/stream.c b/src/stream.c index 4d48ed7a23..6e6a54555a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3722,6 +3722,19 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx ctx->target = (void *)-1; cur_arg++; } + else if (*args[cur_arg] && strcmp(args[cur_arg], "help") == 0) { + chunk_printf(&trash, + "Usage: show sess [ | older | susp | all] [*]\n" + "Dumps active streams (formerly called 'sessions'). Available selectors:\n" + " dump only this stream identifier (0x...)\n" + " all dump all stream in large format\n" + " older only display stream older than \n" + " susp report streams considered suspicious\n" + "Available options: \n" + " show-uri also display the transaction URI, if available\n" + "Without any argument, all streams are dumped in a shorter format."); + return cli_err(appctx, trash.area); + } else if (*args[cur_arg]) { ctx->target = (void *)strtoul(args[cur_arg], NULL, 0); if (ctx->target) @@ -3734,7 +3747,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx ctx->flags |= CLI_SHOWSESS_F_DUMP_URI; } else { - chunk_printf(&trash, "Unsupported option '%s'.\n", args[cur_arg]); + chunk_printf(&trash, "Unsupported option '%s', try 'help' for more info.\n", args[cur_arg]); return cli_err(appctx, trash.area); } cur_arg++; @@ -4050,7 +4063,7 @@ static int cli_parse_shutdown_sessions_server(char **args, char *payload, struct /* register cli keywords */ static struct cli_kw_list cli_kws = {{ },{ - { { "show", "sess", NULL }, "show sess [|all|susp|older ] : report the list of current sessions or dump this exact session", cli_parse_show_sess, cli_io_handler_dump_sess, cli_release_show_sess }, + { { "show", "sess", NULL }, "show sess [help||all|susp|older...] : report the list of current streams or dump this exact stream", cli_parse_show_sess, cli_io_handler_dump_sess, cli_release_show_sess }, { { "shutdown", "session", NULL }, "shutdown session [id] : kill a specific session", cli_parse_shutdown_session, NULL, NULL }, { { "shutdown", "sessions", "server" }, "shutdown sessions server / : kill sessions on a server", cli_parse_shutdown_sessions_server, NULL, NULL }, {{},}