mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* main.h, misc.c (parse_options): Add the ability to have help
strings in xxx-options commands. * keyserver.c (keyserver_opts), import.c (parse_import_options), export.c (parse_export_options), g10.c (parse_list_options, main): Add help strings to xxx-options.
This commit is contained in:
parent
65566b5633
commit
4afa18bcaa
7 changed files with 130 additions and 63 deletions
15
g10/misc.c
15
g10/misc.c
|
@ -968,11 +968,20 @@ parse_options(char *str,unsigned int *options,
|
|||
|
||||
if (str && !strcmp (str, "help"))
|
||||
{
|
||||
int i;
|
||||
int i,maxlen=0;
|
||||
|
||||
/* 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))
|
||||
maxlen=strlen(opts[i].name);
|
||||
|
||||
for(i=0;opts[i].name;i++)
|
||||
printf ("%s\n", opts[i].name);
|
||||
g10_exit (0);
|
||||
if(opts[i].help)
|
||||
printf("%s%*s%s\n",opts[i].name,
|
||||
maxlen+2-strlen(opts[i].name),"",_(opts[i].help));
|
||||
|
||||
g10_exit(0);
|
||||
}
|
||||
|
||||
while((tok=optsep(&str)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue