diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-12-20 21:42:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-12-20 21:42:35 +0100 |
commit | c886c7e6daad3a58f218d694f1c37a033af71572 (patch) | |
tree | e39459e07244b7a6f6ff98c3c1b228f9150beb23 | |
parent | 02a515152058be60b3eebc4b710e46c7c6f32660 (diff) |
Add usage statement
-rwxr-xr-x | bin/hashl | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -30,7 +30,7 @@ my $db; GetOptions( 'd|database=s' => \$db_file, 's|read-size=i' => sub { $read_size = $_[1] * 1024 }, -); +) or usage(); if (substr($db_file, 0, 1) ne '/') { $db_file = "${base}/${db_file}"; @@ -38,8 +38,16 @@ if (substr($db_file, 0, 1) ne '/') { my $action = $ARGV[0]; +sub usage { + die(<<"EOF"); +Usage: $0 [options] <update|list|info|...> [args] +See 'perldoc -F $0' (or 'man $0' if it is properly installed) +EOF + +} + if (not defined $action) { - die("Usage: $0 <action>\n"); + usage(); } if (-r $db_file) { @@ -206,6 +214,9 @@ elsif ($action eq 'info') { db_info(); } } +else { + usage(); +} __END__ @@ -215,7 +226,7 @@ B<hashl> - Create database with partial file hashes, check if other files are in =head1 SYNOPSIS -B<hashl> [B<-d> I<dbfile>] I<action> [I<args>] +B<hashl> [B<-d> I<dbfile>] [B<-s> I<read-size>] I<action> [I<args>] =head1 DESCRIPTION |