GNU bug report logs -
#44248
Indentation of --help and --version
Previous Next
Full log
View this message in rfc822 format
On 28.10.2020 21:55, Bernhard Voelker wrote:
> We have so many utils that it may be worth writing some utility functions
> to automatically do the alignment. Usually, that part of the usage output
> has 3 columns:
> a) the short option (if any),
> b) the long option (if any),
> c) the description (maybe multiline).
I completely agree. This would be nice to have, both for users and for
translators.
> E.g. for ls.c:usage:
> usage_param("-a", "--all", _("do not ignore entries starting with ."));
> ...
> usage_param(NULL, "--dereference-command-line-symlink-to-dir",
> _("follow each command line symbolic link\n"
> "that points to a directory"));
> usage_param_help();
> usage_param_version();
> and a final:
> usage_param_finish();
This code adds a bit of redundancy. The relation between -a and --all
is already expressed when setting up the getopt_long. It is repeated here.
Ideally there would be a single definition from which both the
getopt_long options and the --help string are derived. Some prior art
can be found at https://golang.org/pkg/flag/.
I don't like the hard line break in the option description. The line
breaks should be computed based on the terminal size or a fixed line
width. It's not possible to predict the screen column in which in the
option description will start, since that depends on the names of the
other options. Therefore, the option descriptions should be wrapped as
necessary. See fold(1).
Roland
This bug report was last modified 4 years and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.