From baa20d6eb8312af5c741bcd662657e6e5e62f63c Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 13 Mar 2024 16:58:52 +0100 Subject: [PATCH] vsh: Fix option formatting for 'VHS_OT_ARGV' options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While previous fixes kept the help output unchanged as base for the refactors it turns out that the formatting of help for argv options is wrong. Specifically in SYNOPSIS the non-positional _ARGV would have the option name in square brackets (which in other cases means that given thing is optional) despite being required. Similarly in the DESCRIPTION section positional versions would not show the optional argument name and also didn't use the three dots to signal that it can be used multiple times. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tools/vsh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index eeee58d39e..cbddc5ed92 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -714,9 +714,9 @@ vshCmddefHelp(const vshCmdDef *def) } } else { if (opt->required) { - fprintf(stdout, _(" {[--%1$s] }..."), opt->name); + fprintf(stdout, _(" --%1$s ..."), opt->name); } else { - fprintf(stdout, _(" [[--%1$s] ]..."), opt->name); + fprintf(stdout, _(" [--%1$s ]..."), opt->name); } } break; @@ -765,9 +765,9 @@ vshCmddefHelp(const vshCmdDef *def) case VSH_OT_ARGV: if (opt->positional) { - optstr = g_strdup_printf("<%s>", opt->name); + optstr = g_strdup_printf(_("[--%1$s] ..."), opt->name); } else { - optstr = g_strdup_printf(_("[--%1$s] "), opt->name); + optstr = g_strdup_printf(_("--%1$s ..."), opt->name); } break;