Package: help2man
Version: 1.36.4
Severity: wishlist
Tags: patch

Here is a patch that adds support for programs that don't have a
--version option, in the form of a --version-string option which
specifies the string to be used as version of the program.

diff -Nru help2man-1.36.4/ChangeLog help2man-1.36.4.0/ChangeLog
--- help2man-1.36.4/ChangeLog	2006-02-27 14:44:53.000000000 +0100
+++ help2man-1.36.4.0/ChangeLog	2008-08-11 21:18:55.000000000 +0200
@@ -1,3 +1,9 @@
+help2man (1.36.4.0) unstable; urgency=low
+
+  * Add --version-string option
+
+ -- Lionel Elie Mamane <[EMAIL PROTECTED]>  Mon, 11 Aug 2008 21:18:55 +0200
+
 help2man (1.36.4) unstable; urgency=low
 
   * Add sv translation from Daniel Nylander (closes: #349568).
diff -Nru help2man-1.36.4/debian/changelog help2man-1.36.4.0/debian/changelog
--- help2man-1.36.4/debian/changelog	2006-02-27 14:44:53.000000000 +0100
+++ help2man-1.36.4.0/debian/changelog	2008-08-11 21:18:55.000000000 +0200
@@ -1,3 +1,9 @@
+help2man (1.36.4.0) unstable; urgency=low
+
+  * Add --version-string option
+
+ -- Lionel Elie Mamane <[EMAIL PROTECTED]>  Mon, 11 Aug 2008 21:18:55 +0200
+
 help2man (1.36.4) unstable; urgency=low
 
   * Add sv translation from Daniel Nylander (closes: #349568).
diff -Nru help2man-1.36.4/help2man.info help2man-1.36.4.0/help2man.info
--- help2man-1.36.4/help2man.info	2006-02-27 15:05:54.000000000 +0100
+++ help2man-1.36.4.0/help2man.info	2008-08-11 21:22:16.000000000 +0200
@@ -146,6 +146,10 @@
 `--version-option=OPTION'
      version option string
 
+`--version-string=OPTION'
+     Do not run the program with --version, but use OPTION as version
+     string.
+
 
 File: help2man.info,  Node: --help recommendations,  Next: Makefile usage,  Prev: Including text,  Up: Top
 
diff -Nru help2man-1.36.4/help2man.PL help2man-1.36.4.0/help2man.PL
--- help2man-1.36.4/help2man.PL	2005-10-16 17:38:47.000000000 +0200
+++ help2man-1.36.4.0/help2man.PL	2008-08-11 22:20:24.000000000 +0200
@@ -163,6 +163,7 @@
 
  -h, --help-option=STRING     help option string
  -v, --version-option=STRING  version option string
+ --version-string=STRING      version string
 
 Report bugs to <[EMAIL PROTECTED]>.
 EOT
@@ -173,7 +174,7 @@
 my $locale = 'C';
 my $help_option = '--help';
 my $version_option = '--version';
-my ($opt_name, @opt_include, $opt_output, $opt_info, $opt_no_info);
+my ($opt_name, @opt_include, $opt_output, $opt_info, $opt_no_info, $version_string);
 
 my %opt_def = (
     'n|name=s'		 => \$opt_name,
@@ -188,6 +189,7 @@
     'N|no-info'		 => \$opt_no_info,
     'h|help-option=s'	 => \$help_option,
     'v|version-option=s' => \$version_option,
+    'version-string=s'   => \$version_string,
 );
 
 # Parse options.
@@ -297,11 +299,26 @@
 }
 
 # Grab help and version info from executable.
-my ($help_text, $version_text) = map {
+my ($help_text) = map {
     join '', map { s/ +$//; expand $_ } `$ARGV[0] $_ 2>/dev/null`
 	or kark N_("%s: can't get `%s' info from %s"), $this_program,
 	    $_, $ARGV[0]
-} $help_option, $version_option;
+} $help_option;
+
+my $version_text;
+
+if ($version_string)
+{
+    $version_text = $version_string . "\n";
+}
+else
+{
+    ($version_text) = map {
+	join '', map { s/ +$//; expand $_ } `$ARGV[0] $_ 2>/dev/null`
+	    or kark N_("%s: can't get `%s' info from %s"), $this_program,
+	    $_, $ARGV[0]
+	} $version_option;
+}
 
 my $date = strftime "%B %Y", localtime;
 (my $program = $ARGV[0]) =~ s!.*/!!;

Reply via email to