aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJuanma Barranquero <[email protected]>2006-11-02 11:52:15 +0000
committerJuanma Barranquero <[email protected]>2006-11-02 11:52:15 +0000
commit43983eb155ae7edca7ad3f035147dfdde5875860 (patch)
tree8533c6c80af05d7a67d970b5d572934b104516d4 /lib-src
parent82306b14c3da167cb468bf716f08a669a7ab6e7f (diff)
When called with no arguments (not even a filter), show help instead of
blindingly dumping every single ChangeLog available. Doc fix. Update version.
Diffstat (limited to 'lib-src')
-rwxr-xr-xlib-src/grep-changelog49
1 files changed, 30 insertions, 19 deletions
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
index e3d3af2c57..8c19486ea2 100755
--- a/lib-src/grep-changelog
+++ b/lib-src/grep-changelog
@@ -36,22 +36,33 @@ use vars qw($author $regexp $exclude $from_date $to_date
@entries);
use Getopt::Long;
-my $result = GetOptions ("author=s" => \$author,
- "text=s" => \$regexp,
- "exclude=s" => \$exclude,
- "from-date=s" => \$from_date,
- "to-date=s" => \$to_date,
- "rcs-log" => \$rcs_log,
- "with-date" => \$with_date,
- "reverse!" => \$reverse,
- "version" => \$version,
- "help" => \$help);
-
-# If date options are specified, check that they have the format
-# YYYY-MM-DD.
-
-$result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
-$result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+
+my $result;
+
+if (@ARGV == 0) {
+
+ # No arguments cannot posibly mean "show everything"!!
+ $result = 0;
+
+} else {
+
+ $result = GetOptions ("author=s" => \$author,
+ "text=s" => \$regexp,
+ "exclude=s" => \$exclude,
+ "from-date=s" => \$from_date,
+ "to-date=s" => \$to_date,
+ "rcs-log" => \$rcs_log,
+ "with-date" => \$with_date,
+ "reverse!" => \$reverse,
+ "version" => \$version,
+ "help" => \$help);
+
+ # If date options are specified, check that they have the format
+ # YYYY-MM-DD.
+
+ $result = 0 if $from_date && $from_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+ $result = 0 if $to_date && $to_date !~ /^\d\d\d\d-\d\d-\d\d$/;
+}
# Print usage information and exit when necessary.
@@ -77,7 +88,7 @@ Valid options are:
--help Print this help
If no CHANGELOG is specified scan the files "ChangeLog" and
-"ChangeLog.1+" in the current directory. Old-style dates in ChangeLogs
+"ChangeLog.N+" in the current directory. Old-style dates in ChangeLogs
are not recognized.
USAGE
exit !$help;
@@ -86,7 +97,7 @@ USAGE
# Print version info and exit if `--version' was specified.
if ($version) {
- print "0.2\n";
+ print "0.3\n";
exit 0;
}
@@ -233,7 +244,7 @@ sub parse_changelog {
# If files were specified on the command line, parse those files in the
# order supplied by the user; otherwise parse default files ChangeLog and
-# ChangeLog.1+ according to $reverse.
+# ChangeLog.NNN according to $reverse.
unless (@ARGV > 0) {
@ARGV = ("ChangeLog");