btrbk: print version and help to stdout

pull/459/head
Axel Burri 2022-03-25 15:20:20 +01:00
parent be07f1908a
commit 4fcbbad802
1 changed files with 6 additions and 7 deletions

13
btrbk
View File

@ -398,7 +398,7 @@ $SIG{INT} = sub {
sub VERSION_MESSAGE sub VERSION_MESSAGE
{ {
print STDERR $VERSION_INFO . "\n\n"; print $VERSION_INFO . "\n";
} }
sub ERROR_HELP_MESSAGE sub ERROR_HELP_MESSAGE
@ -412,7 +412,7 @@ sub HELP_MESSAGE
return if($quiet); return if($quiet);
#80----------------------------------------------------------------------------- #80-----------------------------------------------------------------------------
if($program_name eq "lsbtr") { if($program_name eq "lsbtr") {
print STDERR <<"END_HELP_LSBTR"; print <<"END_HELP_LSBTR";
usage: lsbtr [<options>] [[--] <path>...] usage: lsbtr [<options>] [[--] <path>...]
options: options:
@ -430,7 +430,7 @@ For additional information, see $PROJECT_HOME
END_HELP_LSBTR END_HELP_LSBTR
} }
else { else {
print STDERR <<"END_HELP_BTRBK"; print <<"END_HELP_BTRBK";
usage: btrbk [<options>] <command> [[--] <filter>...] usage: btrbk [<options>] <command> [[--] <filter>...]
options: options:
@ -5376,8 +5376,8 @@ MAIN:
$program_name =~ s/^.*\///; # remove path $program_name =~ s/^.*\///; # remove path
my @getopt_options = ( my @getopt_options = (
# common options # common options
'help|h' => sub { VERSION_MESSAGE(); HELP_MESSAGE(0); exit 0; }, 'help|h' => sub { HELP_MESSAGE; exit 0; },
'version' => sub { VERSION_MESSAGE(); exit 0; }, 'version' => sub { VERSION_MESSAGE; exit 0; },
'quiet|q' => \$quiet, 'quiet|q' => \$quiet,
'verbose|v' => sub { $loglevel = ($loglevel =~ /^[0-9]+$/) ? $loglevel+1 : 2; }, 'verbose|v' => sub { $loglevel = ($loglevel =~ /^[0-9]+$/) ? $loglevel+1 : 2; },
'loglevel|l=s' => \$loglevel, 'loglevel|l=s' => \$loglevel,
@ -5423,8 +5423,7 @@ MAIN:
} }
my $command = shift @ARGV; my $command = shift @ARGV;
unless($command) { unless($command) {
VERSION_MESSAGE(); HELP_MESSAGE;
HELP_MESSAGE(0);
exit 2; exit 2;
} }