From f3cc628fd039a58e34d2d9b8197825e2b3207d8f Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 27 Oct 2024 14:21:54 +0000 Subject: [PATCH] cmd: fix extra comma after command name in usage help message --- cmd/command.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/command.c b/cmd/command.c index 11151aa..4ad6b70 100644 --- a/cmd/command.c +++ b/cmd/command.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -313,20 +312,20 @@ static void get_command_string(struct b_command *cmd, b_string *out) r++; } - if (r == 1) { - b_string_append_cstr(out, ", "); - } - if (cmd->b_short_name) { + if (r > 0) { + b_string_append_cstr(out, ", "); + } + b_string_append_cstrf(out, F_GREEN "-%c" F_RESET, cmd->b_short_name); r++; } - if (r == 2) { - b_string_append_cstr(out, ", "); - } - if (cmd->b_long_name) { + if (r > 0) { + b_string_append_cstr(out, ", "); + } + b_string_append_cstrf(out, F_GREEN "--%s" F_RESET, cmd->b_long_name); r++; }