GNU bug report logs - #44248
Indentation of --help and --version

Previous Next

Package: coreutils;

Reported by: Roland Illig <roland.illig <at> gmx.de>

Date: Tue, 27 Oct 2020 00:04:02 UTC

Severity: normal

Full log


Message #23 received at 44248 <at> debbugs.gnu.org (full text, mbox):

From: Roland Illig <roland.illig <at> gmx.de>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Pádraig Brady <P <at> draigBrady.com>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 44248 <at> debbugs.gnu.org
Subject: Re: bug#44248: Indentation of --help and --version
Date: Thu, 29 Oct 2020 22:25:43 +0100
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.