Re: Unify the --help and --version descriptions in man pages?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Karel,

Am Di., 1. Feb. 2022 um 13:58 Uhr schrieb Karel Zak <kzak@xxxxxxxxxx>:
>
> On Mon, Jan 31, 2022 at 09:17:22PM +0100, Mario Blättermann wrote:
> > Hello Karel,
> >
> > Am Mo., 31. Jan. 2022 um 10:35 Uhr schrieb Karel Zak <kzak@xxxxxxxxxx>:
> > >
> > > On Sat, Jan 29, 2022 at 12:57:12PM +0100, Mario Blättermann wrote:
> > > > I've just noticed the commit »docs: add man-common/in-bytes.adoc«.
> > > > What about to unify the descriptions of the --help and the --version
> > > > options in the man pages in a similar manner? Besides to simplify the
> > > > maíntenance, it would also shrink the .po file of the man pages a bit.
> > >
> > > Arbitrary unification and consolidation is wanted, go ahead ;-)
> > >
> > > > --- blockdev.8.adoc     2021-11-26 17:40:06.931013901 +0100
> > > > +++ blockdev.8.adoc    2022-01-29 12:47:43.087144014 +0100
> > > > @@ -40,10 +40,10 @@
> > > > Print a report for the specified device. It is possible to give multiple device
> > > > s. If none is given, all devices which appear in _/proc/partitions_ are shown. N
> > > > ote that the partition StartSec is in 512-byte sectors.
> > > >
> > > > *-h*, *--help*::
> > > > -Display help text and exit.
> > > > +include::man-common/help-description.adoc[]
> > > >
> > > > *-V*, *--version*::
> > > > -Print version and exit.
> > > > +include::man-common/version-description.adoc[]
> > >
> > > Do we need to separate help & version? Maybe we can use
> > >
> > >   include::man-common/help-and-version.adoc[]
> > >
> > > where will be everything.
> > >
> > >       *-h*, *--help*
> > >               Display help text and exit.
> > >
> > >       *-V*, *--version*
> > >               Display version information and exit.
> > >
> > > We use the same in usage() function (--help output) where both
> > > items are printed together by USAGE_HELP_OPTIONS macro. (see 'git grep
> > > USAGE_HELP_OPTIONS')
> > >
> > > IMHO --help and --version is so generic that we do not need to keep it
> > > sorted in man pages. I guess it's OK to keep it at the end of the list
> > > of options like we use in usage().
> >
> >
> > OK, this is possible for --help without any other changes; all our
> > tools have the same options (*-h*, *--help*). But for --version, the
> > single-letter option differs. While most of the tools have *-V*,
> > *--version*, it is *-v*, *--version* for the following ones:
> >
> > sfdisk.8.adoc
> > chsh.1.adoc
> > chfn.1.adoc
> >
> > For sfdisk, -V has a different meaning, and for chsh and chfn the
> > option -V is unknown (invalid). So we could change chsh and chfn to
> > accept -V (and maybe drop -v in turn), and we leave the --help and
> > --version part of sfdisk.8.adoc untouched.
>
> For chsh and chfn it's probably good idea to support also -V, but for
> backward compatibility it would be nice to keep -v in code (not
> necessary in man page).
>
> And yes, sfdisk.8.adoc keep untouched.
>

See my pull request. Just stumbled upon some other peculiarities:

"fsck" doesn't know -h; the single-letter help option is "-?".

"kill" doesn't accept neither, -h, -V, nor --version; only --help is accepted.

The behavior of "tunelp" is unknown, because it is not available from
my system. The current man page doesn't contain neither of the -h and
-V options.


In the current state with "--help" and "--version" concatenated into
one, it is only possible to add some extra info to --version, if
needed (see the hardlink man page, for example). If a man page author
needs to add something to --help, he needs to get back to the old
behavior. But I don't expect that somebody insists on adding important
extra information to the --help option.


Best Regards,
Mario




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux