From 4f973ab23a3afef5949c96de8ddf537e284b0707 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 25 Nov 2024 18:35:51 +0100 Subject: [PATCH] MINOR: cli/quic: Add a "help" keyword to show quic Add a help keyword to show quic, that will provide a longer explanation of all the available options than what is provided by the command "help". --- src/quic_cli.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/quic_cli.c b/src/quic_cli.c index 6d34a8312..0e2b21bd3 100644 --- a/src/quic_cli.c +++ b/src/quic_cli.c @@ -75,6 +75,21 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx ctx->fields = QUIC_DUMP_FLD_MASK; ++argc; } + else if (strcmp(args[argc], "help") == 0) { + chunk_printf(&trash, + "Usage: show quic [help|] []\n" + "Dumps information about QUIC connections. Available output formats:\n" + " oneline dump a single, netstat-like line per connection (default)\n" + " full dump all known information about each connection\n" + " * only dump certain information, defined by a comma-delimited list\n" + " of levels among 'tp', 'sock', 'pktns', 'cc', or 'mux'\n" + " help display this help\n" + "Available output filters:\n" + " all dump all connections (the default)\n" + " dump only the connection matching this identifier (0x...)\n" + "Without any argument, all connections are dumped using the oneline format.\n"); + return cli_err(appctx, trash.area); + } else if (*args[argc]) { struct ist istarg = ist(args[argc]); struct ist field = istsplit(&istarg, ','); @@ -101,7 +116,7 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx * field name has been specified. */ if (istarg.len || ctx->fields) { - cli_err(appctx, "Invalid field.\n"); + cli_err(appctx, "Invalid field, use 'help' for more options.\n"); return 1; } @@ -140,7 +155,7 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx ctx->flags |= QC_CLI_FL_SHOW_ALL; } else { - cli_err(appctx, "Invalid argument.\n"); + cli_err(appctx, "Invalid argument, use 'help' for more options.\n"); return 1; } @@ -489,7 +504,7 @@ static void cli_release_show_quic(struct appctx *appctx) } static struct cli_kw_list cli_kws = {{ }, { - { { "show", "quic", NULL }, "show quic [] [] : display quic connections status", cli_parse_show_quic, cli_io_handler_dump_quic, cli_release_show_quic }, + { { "show", "quic", NULL }, "show quic [help|] [] : display quic connections status", cli_parse_show_quic, cli_io_handler_dump_quic, cli_release_show_quic }, {{},} }};