[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help2man: minor change request for coreutils
From: |
Brendan O'Dea |
Subject: |
Re: help2man: minor change request for coreutils |
Date: |
Wed, 24 Nov 2004 19:25:18 +1100 |
User-agent: |
Mutt/1.5.6+20040907i |
On Tue, Nov 23, 2004 at 11:57:15PM +0100, Jim Meyering wrote:
>It's an odd situation, since test doesn't support --help or --version,
>but the alternate-name for that code is `[', which does accept
>those options.
Odd indeed.
>I hesitated to request it, thinking this may be the only
>case in which it's needed, but who knows...
Rather than another option, attached is an alternative I'd prefer. If
this suits I'll apply/upload when I get home.
The idea is to override $program from the NAME paragraph given in your
include files, so if test.x contains either of:
test \- check file types and compare values
test, [ \- check file types and compare values
You'll end up with "test", even if the program was invoked as "[".
I checked all of the help2man generated pages under /usr/share/man/man1
and came up with the following list affected by this change:
install.1 install ginstall
test.1 [ test
texi2dvi4a2ps.1 texi2dvi texi2dvi4a2ps
psset.1 psset psmandup
Columns are: the page, current value of $program (as pulled from .TH)
and what will be used with this change given the contents of the NAME
paragraph.
Not sure which of install/ginstall is correct, but it does fixes your
test/[ problem.
The other two are from a2ps, the texi2dvi4a2ps change is probably
correct, and psset is a bug in psset.x (Cc'd to Akim).
--bod
--- help2man.orig 2004-11-20 11:26:40.000000000 +1100
+++ help2man 2004-11-24 18:41:44.000000000 +1100
@@ -283,12 +283,22 @@
# No info for `info' itself.
$opt_no_info = 1 if $program eq 'info';
-# --name overrides --include contents.
-$include{_('NAME')} = "$program \\- $opt_name\n" if $opt_name;
-
-# Default (useless) NAME paragraph.
-$include{_('NAME')} ||= sprintf _("%s \\- manual page for %s %s") . "\n",
- $program, $program, $version;
+for ($include{_('NAME')})
+{
+ if ($opt_name) # --name overrides --include contents.
+ {
+ $_ = "$program \\- $opt_name\n";
+ }
+ elsif ($_) # Use first name given as $program
+ {
+ $program = $1 if /^([^\s,]+)(?:,?\s*[^\s,\\-]+)*\s+\\?-/;
+ }
+ else # Set a default (useless) NAME paragraph.
+ {
+ $_ = sprintf _("%s \\- manual page for %s %s") . "\n", $program,
+ $program, $version;
+ }
+}
# Man pages traditionally have the page title in caps.
my $PROGRAM = uc $program;
- Re: help2man: minor change request for coreutils,
Brendan O'Dea <=