diff --git a/bin/db-ris b/bin/db-ris index f3e3bebc4c059417fd0c1310104e8dc88d13a570..debbe0e781accf10d817c71b6bd69009401770e7 100755 --- a/bin/db-ris +++ b/bin/db-ris @@ -5,7 +5,7 @@ use 5.010; our $VERSION = '0.0'; -use Getopt::Long; +use Getopt::Long qw(:config no_ignore_case); use List::Util qw(first max); use Travel::Status::DE::DeutscheBahn; @@ -18,11 +18,14 @@ my @output; binmode( STDOUT, ':encoding(utf-8)' ); GetOptions( - 'd|date=s' => \$date, - 'v|via=s' => \$filter_via, - 'm|mot=s' => \$types, - 't|time=s' => \$time, -); + 'd|date=s' => \$date, + 'h|help' => sub { show_help(0) }, + 'm|mot=s' => \$types, + 't|time=s' => \$time, + 'v|via=s' => \$filter_via, + 'V|version' => \&show_version, + +) or show_help(1); for my $type ( split( qr{,}, $types ) ) { if ( substr( $type, 0, 1 ) eq q{!} ) { @@ -40,6 +43,22 @@ my $status = Travel::Status::DE::DeutscheBahn->new( time => $time, ); +sub show_help { + my ($code) = @_; + + print 'Usage: db-ris [-d ] [-m ] [-t