From d30a3aff786d3ce655cc043feda7b0462f3ab998 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 25 Mar 2021 21:48:02 +0100 Subject: make "place" optional --- bin/efa-m | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'bin/efa-m') diff --git a/bin/efa-m b/bin/efa-m index e30a6fb..7cda15e 100755 --- a/bin/efa-m +++ b/bin/efa-m @@ -56,7 +56,7 @@ if ($list_services) { show_services(); } -if ( @ARGV != 2 ) { +if ( @ARGV < 1 or @ARGV > 2 ) { show_help(1); } @@ -66,7 +66,14 @@ if ( @ARGV != 2 ) { @grep_mots = split( qr{,}, join( q{,}, @grep_mots ) ); @grep_platforms = split( qr{,}, join( q{,}, @grep_platforms ) ); -my ( $place, $input ) = @ARGV; +my ( $place, $input ); + +if ( @ARGV == 1 ) { + $input = $ARGV[0]; +} +else { + ( $place, $input ) = @ARGV; +} if ( $input =~ s{ ^ (? address|poi|stop) : }{}x ) { $input_type = $+{type}; @@ -121,7 +128,7 @@ sub new_efa_by_url { sub show_help { my ($code) = @_; - print "Usage: efa-m [-d ] [-t ] \n" + print "Usage: efa-m [-d ] [-t ] [place] \n" . "See also: man efa-m\n"; exit $code; @@ -385,7 +392,7 @@ efa-m - Unofficial interface to the efa.vrr.de departure monitor B [B<-Lr>] [B<-d> I] [B<-t> I] [B<-l> I] [B<-p> I] [B<-u> I] -I [IB<:>]I +[I] [IB<:>]I =head1 VERSION @@ -393,9 +400,11 @@ version 1.17 =head1 DESCRIPTION -B lists scheduled tram, bus and train departures at the location I -in I. Realtime data (i.e. delays) is included if available, it's -visible in the output as a "+x" remark (meaning a delay of x minutes). +B lists scheduled tram, bus and train departures at the location I. +If I is specified, I refers to a location within I. Otherwise, +I must be self-contained. I.e., both C<< efa Essen Hbf >> and +C<< efa "Essen Hbf" >> are valid. Note, however, than C<< efa E Hbf >> works, +but C<< efa "E Hbf" >> does not. By default, I refers to a stop, this can be changed by specifying I. Supported types are B
and B (point of interest). -- cgit v1.2.3