1
0
mirror of https://github.com/git/git.git synced 2025-03-16 11:55:16 +00:00

annotate: display usage information if no filename was given

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
This commit is contained in:
Matthias Kestenholz 2006-04-28 10:41:19 +02:00 committed by Junio C Hamano
parent d0ad165366
commit fe77bb1a02

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