aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-02-21 13:09:03 +0000
committerWerner Koch <[email protected]>2024-02-21 13:09:03 +0000
commitc3b6eaedd8707bca9892a0e188bf04532ca70818 (patch)
tree25b1e27c89aac388c094419b64bdda22d7e861ad
parentcore: Add "wipe" mode flag. (diff)
downloadlibgpg-error-c3b6eaedd8707bca9892a0e188bf04532ca70818.tar.gz
libgpg-error-c3b6eaedd8707bca9892a0e188bf04532ca70818.zip
argparse: Adjust help output for command mode.
* src/argparse.c (show_help): Adjust for command style options.
-rw-r--r--src/argparse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/argparse.c b/src/argparse.c
index bd44aef..6e6e158 100644
--- a/src/argparse.c
+++ b/src/argparse.c
@@ -3146,7 +3146,13 @@ show_help (opttable_t *opts, unsigned int nopts, unsigned int flags)
{
tmp[0] = opts[ordtbl[i]].short_opt < 256?',':' ';
tmp[1] = 0;
- j += writestrings (0, tmp, " --", opts[ordtbl[i]].long_opt, NULL);
+ if ((flags & ARGPARSE_FLAG_COMMAND)
+ && (opts[ordtbl[i]].flags & ARGPARSE_OPT_COMMAND))
+ j += writestrings (0, tmp,
+ " ", opts[ordtbl[i]].long_opt, " ", NULL);
+ else
+ j += writestrings (0, tmp,
+ " --", opts[ordtbl[i]].long_opt, NULL);
if (s && *s == '|' )
{
if ( *++s != '=' )