diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-03-25 21:48:02 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-03-25 21:48:02 +0100 |
commit | d30a3aff786d3ce655cc043feda7b0462f3ab998 (patch) | |
tree | d1d038bdfab43075a2d93569808b3a7627c66285 /bin/efa-m | |
parent | 2ccac68c6be4c2003168c6e552c6f2bd402626d1 (diff) |
make "place" optional
Diffstat (limited to 'bin/efa-m')
-rwxr-xr-x | bin/efa-m | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -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{ ^ (?<type> 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 <dd.mm.yyyy>] [-t <hh:mm>] <city> <station>\n" + print "Usage: efa-m [-d <dd.mm.yyyy>] [-t <hh:mm>] [place] <station>\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<efa-m> [B<-Lr>] [B<-d> I<dd.mm.yyyy>] [B<-t> I<hh:mm>] [B<-l> I<lines>] [B<-p> I<platforms>] [B<-u> I<url>] -I<city> [I<type>B<:>]I<name> +[I<city>] [I<type>B<:>]I<name> =head1 VERSION @@ -393,9 +400,11 @@ version 1.17 =head1 DESCRIPTION -B<efa-m> lists scheduled tram, bus and train departures at the location I<name> -in I<city>. 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<efa-m> lists scheduled tram, bus and train departures at the location I<name>. +If I<city> is specified, I<name> refers to a location within I<city>. Otherwise, +I<name> 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<name> refers to a stop, this can be changed by specifying I<type>. Supported types are B<address> and B<poi> (point of interest). |