[Po4a-devel]Usage and help messages
Danilo Piazzalunga
danilopiazza@libero.it
Thu, 3 Mar 2005 16:40:05 +0100
--Boundary-00=_V/yJC7KXbbU50ou
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hi all,
Currently, the po4a utilities print only a terse help message when invoked
with --help, while they print out the full help text when invoked with the
wrong number of parameters or when GetOptions fails.
I guess this should be the other way around, that is:
* No parameters/wrong number of parameters: terse message only
* With --help: full help text
* With a wrong option, e.g. --foobar: still full help text
FYI, I attached the patch to change this behaviour.
Danilo
--Boundary-00=_V/yJC7KXbbU50ou
Content-Type: text/x-diff;
charset="us-ascii";
name="po4a-usage-help.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="po4a-usage-help.diff"
Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.24
diff -u -r1.24 po4a
--- po4a 27 Feb 2005 22:56:00 -0000 1.24
+++ po4a 3 Mar 2005 15:18:42 -0000
@@ -236,7 +236,7 @@
) or pod2usage(1);
# Argument check
-$help && pod2usage (0);
+$help && pod2usage (1);
my ($verbose) = (scalar @verbose);
$verbose = 1 if $debug;
@@ -253,7 +253,7 @@
}
}
-my $config_file= shift(@ARGV) || pod2usage(1);
+my $config_file= shift(@ARGV) || pod2usage(0);
# Check file existence
-e $config_file || die wrap_msg(gettext("File %s does not exist."), $config_file);
Index: po4a-gettextize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-gettextize,v
retrieving revision 1.28
diff -u -r1.28 po4a-gettextize
--- po4a-gettextize 27 Feb 2005 22:56:00 -0000 1.28
+++ po4a-gettextize 3 Mar 2005 15:18:42 -0000
@@ -179,9 +179,9 @@
) or pod2usage(1);
# Argument check
-$help && pod2usage (0);
+$help && pod2usage (1);
$help_fmt && Locale::Po4a::Chooser::list(0);
-pod2usage (1) if (scalar @ARGV > 1) ||
+pod2usage (0) if (scalar @ARGV > 1) ||
(!defined($masterfile)) || (!length($masterfile));
my %options = (
Index: po4a-normalize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-normalize,v
retrieving revision 1.22
diff -u -r1.22 po4a-normalize
--- po4a-normalize 27 Feb 2005 22:56:00 -0000 1.22
+++ po4a-normalize 3 Mar 2005 15:18:42 -0000
@@ -124,9 +124,9 @@
'version|V' => \&show_version
) or pod2usage(1);
-$help && pod2usage (0);
+$help && pod2usage (1);
$help_fmt && Locale::Po4a::Chooser::list(0);
-pod2usage (1) unless scalar @ARGV == 1;
+pod2usage (0) unless scalar @ARGV == 1;
my %options = (
"verbose" => $verbose,
Index: po4a-translate
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-translate,v
retrieving revision 1.34
diff -u -r1.34 po4a-translate
--- po4a-translate 27 Feb 2005 22:56:00 -0000 1.34
+++ po4a-translate 3 Mar 2005 15:18:43 -0000
@@ -201,10 +201,10 @@
'version|V' => \&show_version
) or pod2usage(1);
-$help && pod2usage(0);
+$help && pod2usage(1);
$help_fmt && Locale::Po4a::Chooser::list(0);
-(defined($master_filename) && length($master_filename))||pod2usage(1);
+(defined($master_filename) && length($master_filename))||pod2usage(0);
(defined($po_filename) && length($po_filename)) ||pod2usage(1);
-e $master_filename || die wrap_msg(gettext("File %s does not exist."), $master_filename);
-e $po_filename || die wrap_msg(gettext("File %s does not exist."), $po_filename);
Index: po4a-updatepo
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-updatepo,v
retrieving revision 1.31
diff -u -r1.31 po4a-updatepo
--- po4a-updatepo 27 Feb 2005 22:56:00 -0000 1.31
+++ po4a-updatepo 3 Mar 2005 15:18:43 -0000
@@ -159,9 +159,9 @@
'version|V' => \&show_version)
or pod2usage(1);
-$help && pod2usage (0);
+$help && pod2usage (1);
$help_fmt && Locale::Po4a::Chooser::list(0);
-pod2usage (1) if scalar @masterfiles < 1 || scalar @pofiles < 1;
+pod2usage (0) if scalar @masterfiles < 1 || scalar @pofiles < 1;
my %options = (
"verbose" => $verbose,
--Boundary-00=_V/yJC7KXbbU50ou--