diff options
author | Werner Koch <[email protected]> | 2025-08-01 14:20:32 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2025-08-01 14:20:32 +0000 |
commit | 33362b4d9e0e2777d746b610c53bd0b3fa92d624 (patch) | |
tree | e442906f5eda508fa612ee9f952aae97a122f958 | |
parent | gpg: Try to retrieve a key from LDAP before sending it. (diff) | |
download | gnupg-33362b4d9e0e2777d746b610c53bd0b3fa92d624.tar.gz gnupg-33362b4d9e0e2777d746b610c53bd0b3fa92d624.zip |
gpg: Improve the "help" and "full-help" --foo-options.
* g10/misc.c (parse_options): Also allow option "fullhelp". Print
current status of the option.
-rw-r--r-- | g10/misc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/g10/misc.c b/g10/misc.c index c52091830..43be620e6 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1578,25 +1578,37 @@ parse_options(char *str,unsigned int *options, { char *tok; - if (str && (!strcmp (str, "help") || !strcmp (str, "full-help"))) + if (str && (!strcmp (str, "help") + || !strcmp (str, "full-help") || !strcmp (str, "fullhelp"))) { int i,maxlen=0; int full = *str == 'f'; + int set; /* Figure out the longest option name so we can line these up neatly. */ for(i=0;opts[i].name;i++) - if(opts[i].help && maxlen<strlen(opts[i].name)) + if((full || opts[i].help) && maxlen<strlen(opts[i].name)) maxlen=strlen(opts[i].name); for(i=0;opts[i].name;i++) if(opts[i].help) - es_printf("%s%*s%s\n",opts[i].name, - maxlen+2-(int)strlen(opts[i].name),"",_(opts[i].help)); + { + set = (*options & opts[i].bit); + es_printf("%s%*s%s%s%s%s\n",opts[i].name, + maxlen+2-(int)strlen(opts[i].name),"",_(opts[i].help), + set?" [":"", set? _("enabled"):"", set?"]":""); + } + if (full) for (i=0; opts[i].name; i++) if(!opts[i].help) - es_printf("%s\n",opts[i].name); + { + set = (*options & opts[i].bit); + es_printf("%s%*s%s%s%s\n",opts[i].name, + set? (maxlen+2-(int)strlen(opts[i].name)):0,"", + set?"[":"", set? _("enabled"):"", set?"]":""); + } g10_exit(0); } |