Skip to content

Commit 4f973ab

Browse files
Olivier Houchardwtarreau
authored andcommitted
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".
1 parent 5288d0f commit 4f973ab

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/quic_cli.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
7575
ctx->fields = QUIC_DUMP_FLD_MASK;
7676
++argc;
7777
}
78+
else if (strcmp(args[argc], "help") == 0) {
79+
chunk_printf(&trash,
80+
"Usage: show quic [help|<format>] [<filter>]\n"
81+
"Dumps information about QUIC connections. Available output formats:\n"
82+
" oneline dump a single, netstat-like line per connection (default)\n"
83+
" full dump all known information about each connection\n"
84+
" <levels>* only dump certain information, defined by a comma-delimited list\n"
85+
" of levels among 'tp', 'sock', 'pktns', 'cc', or 'mux'\n"
86+
" help display this help\n"
87+
"Available output filters:\n"
88+
" all dump all connections (the default)\n"
89+
" <id> dump only the connection matching this identifier (0x...)\n"
90+
"Without any argument, all connections are dumped using the oneline format.\n");
91+
return cli_err(appctx, trash.area);
92+
}
7893
else if (*args[argc]) {
7994
struct ist istarg = ist(args[argc]);
8095
struct ist field = istsplit(&istarg, ',');
@@ -101,7 +116,7 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
101116
* field name has been specified.
102117
*/
103118
if (istarg.len || ctx->fields) {
104-
cli_err(appctx, "Invalid field.\n");
119+
cli_err(appctx, "Invalid field, use 'help' for more options.\n");
105120
return 1;
106121
}
107122

@@ -140,7 +155,7 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
140155
ctx->flags |= QC_CLI_FL_SHOW_ALL;
141156
}
142157
else {
143-
cli_err(appctx, "Invalid argument.\n");
158+
cli_err(appctx, "Invalid argument, use 'help' for more options.\n");
144159
return 1;
145160
}
146161

@@ -489,7 +504,7 @@ static void cli_release_show_quic(struct appctx *appctx)
489504
}
490505

491506
static struct cli_kw_list cli_kws = {{ }, {
492-
{ { "show", "quic", NULL }, "show quic [<format>] [<filter>] : display quic connections status", cli_parse_show_quic, cli_io_handler_dump_quic, cli_release_show_quic },
507+
{ { "show", "quic", NULL }, "show quic [help|<format>] [<filter>] : display quic connections status", cli_parse_show_quic, cli_io_handler_dump_quic, cli_release_show_quic },
493508
{{},}
494509
}};
495510

0 commit comments

Comments
 (0)