From: Eugene Crosser Date: Sun, 17 Dec 2006 09:39:01 +0000 (+0000) Subject: add --help option X-Git-Tag: 1.01~1 X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=commitdiff_plain;h=c4a12d60866fcb19955ab86faffd611491fb7b25 add --help option --- diff --git a/README b/README index b6cb4cc..7f8b7ed 100644 --- a/README +++ b/README @@ -41,7 +41,8 @@ there. This way you can preserve index created by hand or by some other script like "mkindex.pl". command-line options: - --incpath: do not try to fine .include diretory upstream, use + --help: print help message and exit + --incpath: do not try to find .include diretory upstream, use specified path (absolute or relavive). Use with causion. --debug: print a lot of debugging info to stdout as you run --asktitle: ask to edit album titles even if there are ".title" files diff --git a/mkgallery.pl b/mkgallery.pl index 1a36884..5c02e0b 100755 --- a/mkgallery.pl +++ b/mkgallery.pl @@ -51,15 +51,35 @@ my $noasktitle = 0; charset("utf-8"); -GetOptions( 'incpath'=>\$incpath, +unless (GetOptions( + 'help'=>\&help, + 'incpath'=>\$incpath, 'asktitle'=>\$asktitle, 'noasktitle'=>\$noasktitle, - 'debug'=>\$debug); + 'debug'=>\$debug)) { + &help; +} my $term = new Term::ReadLine "Edit Title"; FsObj->new(getcwd)->iterate; +sub help { + + print STDERR <<__END__; +usage: $0 [options] + --help: print help message and exit + --incpath: do not try to find .include diretory upstream, use + specified path (absolute or relavive). Use with causion. + --debug: print a lot of debugging info to stdout as you run + --asktitle: ask to edit album titles even if there are ".title" files + --noasktitle: don't ask to enter album titles even where ".title" + files are absent. Use partial directory names as titles. +__END__ + + exit 1; +} + sub new { my $this = shift; my $class;