@matheusbsbs / matheus-bagliano / commits / fe77bb1a02
Fork 0

annotate: display usage information if no filename was given

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>

Matthias Kestenholz committed Apr 28, 2006 at 10:41 UTC fe77bb1a02d5b8dd3915cd27a83b660debaecda4
1 file changed +4 -3
git-annotate.perl
+4 -3
@@ -10,9 +10,10 @@ use warnings;
10 use strict;
11 use Getopt::Long;
12 use POSIX qw(strftime gmtime);
13 +use File::Basename qw(basename dirname);
14
15 sub usage() {
15 - print STDERR 'Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
16 + print STDERR "Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
17 -l, --long
18 Show long rev (Defaults off)
19 -t, --time
@@ -23,7 +24,7 @@ sub usage() {
24 Use revs from revs-file instead of calling git-rev-list
25 -h, --help
26 This message.
26 -';
27 +";
28
29 exit(1);
30 }
@@ -35,7 +36,7 @@ my $rc = GetOptions( "long|l" => \$longrev,
36 "help|h" => \$help,
37 "rename|r" => \$rename,
38 "rev-file|S=s" => \$rev_file);
38 -if (!$rc or $help) {
39 +if (!$rc or $help or !@ARGV) {
40 usage();
41 }
42