annotate: display usage information if no filename was given
authorMatthias Kestenholz <matthias@spinlock.ch>
Fri, 28 Apr 2006 08:41:19 +0000 (10:41 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 28 Apr 2006 21:29:04 +0000 (14:29 -0700)
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
git-annotate.perl

index a7aab25..a6a7a48 100755 (executable)
@@ -10,9 +10,10 @@ use warnings;
 use strict;
 use Getopt::Long;
 use POSIX qw(strftime gmtime);
+use File::Basename qw(basename dirname);
 
 sub usage() {
-       print STDERR 'Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
+       print STDERR "Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
        -l, --long
                        Show long rev (Defaults off)
        -t, --time
@@ -23,7 +24,7 @@ sub usage() {
                        Use revs from revs-file instead of calling git-rev-list
        -h, --help
                        This message.
-';
+";
 
        exit(1);
 }
@@ -35,7 +36,7 @@ my $rc = GetOptions(  "long|l" => \$longrev,
                        "help|h" => \$help,
                        "rename|r" => \$rename,
                        "rev-file|S=s" => \$rev_file);
-if (!$rc or $help) {
+if (!$rc or $help or !@ARGV) {
        usage();
 }