]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: ring/cli: also support "show events -h" to display the help
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Sep 2026 14:25:18 +0000 (16:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 7 Sep 2026 14:29:16 +0000 (16:29 +0200)
Till now it was annoyingly showing "unknown option" which was not much
helpful.

doc/management.txt
src/sink.c

index 02f3aeef6ea7e022a85aa91b10108b6b947166ef..02780b98965dd9a20377b61b55e56620ca5947b8 100644 (file)
@@ -3196,6 +3196,8 @@ show events  [-[wn0rs]*] [<sink>]
         character ('\0' or 0), which might be more convenient for external
         tools.
 
+    -h  show the help message.
+
     -n  directly seeks to the end of the buffer, which is generally combined
         with "-w" to only report new events (like "tail -f").
 
index 1b43343ca8945f6cc0c599986496fa81559e2d57..d6b6c15f8d6485f5b061289814b24a990a7b1e6a 100644 (file)
@@ -379,6 +379,7 @@ static int cli_parse_show_events(char **args, char *payload, struct appctx *appc
                        case 'w' : ring_flags |= RING_WF_WAIT_MODE; break;
                        case 's' : ring_flags |= RING_WF_SANITIZE;  break;
                        case 'r' : ring_flags &= ~RING_WF_SANITIZE; break;
+                       case 'h' : goto show_help;
                        default: return cli_err(appctx, "unknown option");
                        }
                }
@@ -386,6 +387,7 @@ static int cli_parse_show_events(char **args, char *payload, struct appctx *appc
 
        if (!name) {
                /* no arg => report the list of supported sink */
+       show_help:
                chunk_printf(&trash, "Supported events sinks are listed below. Add combinations of -0(zero), -w(wait), -n(new), -r(raw), -s(anitize). Any key to stop.\n");
                list_for_each_entry(sink, &sink_list, sink_list) {
                        chunk_appendf(&trash, "    %-10s : type=%s, %u dropped, %s\n",
@@ -1503,7 +1505,7 @@ REGISTER_POST_CHECK(sink_postcheck);
 REGISTER_POST_DEINIT(sink_deinit);
 
 static struct cli_kw_list cli_kws = {{ },{
-       { { "show", "events", NULL }, "show events [-0nrsw]* [<sink>]          : show event sink state", cli_parse_show_events, NULL, NULL },
+       { { "show", "events", NULL }, "show events [-0hnrsw]* [<sink>]         : show event sink state", cli_parse_show_events, NULL, NULL },
        {{},}
 }};