summaryrefslogtreecommitdiffabout
path: root/renrot
authorAndy Shevchenko <andy@smile.org.ua>2012-07-28 18:13:01 (GMT)
committer Andy Shevchenko <andy@smile.org.ua>2012-07-28 18:13:01 (GMT)
commitdb0f802fbe685cd1e40f09c3789f5ca241648f62 (patch) (unidiff)
tree1eb4cdec2a10deb178057f411e13f926acde3a30 /renrot
parentd2dd2085024b382ee60c3fbdff8effcddda1d408 (diff)
downloadrenrot-db0f802fbe685cd1e40f09c3789f5ca241648f62.tar.gz
renrot-db0f802fbe685cd1e40f09c3789f5ca241648f62.tar.bz2
doc: update usage() to cover few more cases
Now usage() will print either version or short list of options, or full documentation via pod2usage. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> git-svn-id: file:///svnroot/renrot/trunk@614 fe2816f4-e837-0410-b10a-f608c9d244a1
Diffstat (limited to 'renrot') (more/less context) (ignore whitespace changes)
-rwxr-xr-xrenrot47
1 files changed, 13 insertions, 34 deletions
diff --git a/renrot b/renrot
index 3fbbf31..f1dc4ec 100755
--- a/renrot
+++ b/renrot
@@ -303,4 +303,2 @@ sub die_renrot {
303sub getOptions { 303sub getOptions {
304 my $showVersion = 0; # need version
305 my $showHelp = 0; # need help
306 my @tmpTags = (); 304 my @tmpTags = ();
@@ -328,3 +326,3 @@ sub getOptions {
328 326
329 my $getOptions = GetOptions ( 327 GetOptions (
330 # AGGREGATION 328 # AGGREGATION
@@ -386,3 +384,3 @@ sub getOptions {
386 "generate-thumb|g" => \$gen_thm, 384 "generate-thumb|g" => \$gen_thm,
387 "help|?" => \$showHelp, 385 "help|?" => sub { usage(0, 2) },
388 "no-rename|norename" => \$noRename, 386 "no-rename|norename" => \$noRename,
@@ -399,5 +397,5 @@ sub getOptions {
399 "v+" => \$verbose, 397 "v+" => \$verbose,
400 "version" => \$showVersion, 398 "version" => sub { usage(0, 0) },
401 "work-directory|d=s" => \$workDir, 399 "work-directory|d=s" => \$workDir,
402 ); 400 ) or usage(1, 1);
403 401
@@ -449,12 +447,2 @@ sub getOptions {
449 447
450 if ($showHelp != 0) {
451 usage();
452 exit 0;
453 }
454
455 if ($showVersion != 0) {
456 infomsg ("RenRot version $VERSION (r$REVISION)\n");
457 exit 0;
458 }
459
460 if ($extToProcess eq "" and ($fileCount == 0) and $subFileSet eq "") { 448 if ($extToProcess eq "" and ($fileCount == 0) and $subFileSet eq "") {
@@ -468,7 +456,2 @@ sub getOptions {
468 456
469 if ($getOptions == 0) {
470 usage();
471 exit 1;
472 }
473
474 if ($noRenRoTagMtm != 0) { 457 if ($noRenRoTagMtm != 0) {
@@ -1577,11 +1560,8 @@ sub rotateThumbnail {
1577sub usage { 1560sub usage {
1578 # catch warnings if we have problems running perldoc 1561 my $exitcode = shift;
1579 my $evalWarning; 1562 my $verbose = shift;
1580 local $SIG{'__WARN__'} = sub { $evalWarning = $_[0] }; 1563
1581 my $dummy = \*SAVEERR; # avoid "used only once" warning 1564 if ($verbose == 0) {
1582 unless ($^O eq 'os2') { 1565 infomsg ("RenRot version $VERSION (r$REVISION)\n");
1583 open SAVEERR, ">&STDERR"; 1566 } elsif ($verbose == 1) {
1584 open STDERR, '>/dev/null';
1585 }
1586 if (system('perldoc', $0)) {
1587 infomsg ( 1567 infomsg (
@@ -1620,7 +1600,6 @@ Consult the documentation for a full list of options.
1620"); 1600");
1601 } elsif ($verbose == 2) {
1602 pod2usage(-verbose => 2);
1621 } 1603 }
1622 unless ($^O eq 'os2') { 1604 exit $exitcode;
1623 close STDERR;
1624 open STDERR, '>&SAVEERR';
1625 }
1626} 1605}

Return to:

Send suggestions and report system problems to the System administrator.