From ecac6d1934cbfe68bbe0cc5fe5d72cf8c2af5aa8 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sat, 5 Sep 2026 13:28:15 +0200 Subject: [PATCH] lag: say what the command takes, and delete only when asked Two small things about the same command. The usage line offered "lag <1-4> [port]...", which leaves out "lag show" even though that is the only way to see the groups, so the one subcommand a reader most needs is the one the error does not mention. And a group number with no ports after it quietly wiped the group. That is a reasonable thing to want and an unreasonable thing to do by accident, as it is one fat-fingered return away from a bare "lag 1". It now takes "lag 1 delete" or "lag 1 d", and a bare group number prints the usage instead. Nothing changes for a saved configuration: "lag 1 5 6" is what gets written and what gets replayed, and neither the old bare form nor the new delete matches the pattern that decides what is persisted. --- cmd_parser.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index bd2fc544..8798e8be 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -406,10 +406,16 @@ void parse_lag(void) if (group > 3) goto err; + if (cmd_words_len == 2) + goto err; + + if (cmd_compare(2, "delete") || cmd_compare(2, "d")) { + port_lag_members_set(group, 0); + return; + } + uint8_t w = 2; while (w < cmd_words_len) { -// write_char('|'); print_byte(w); write_char(':'); write_char(cmd_buffer[cmd_words_b[w]]); write_char('-'); - // Parse port. if (cmd_parse_port_separator(cmd_words_b[w++]) == 0) goto err; @@ -419,7 +425,7 @@ void parse_lag(void) port_lag_members_set(group, members); return; err: - print_string("Error: lag <1-4> [port]...\n"); + print_string("Error: lag (show | <1-4> (delete | ...))\n"); }