summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hafas43
1 files changed, 29 insertions, 14 deletions
diff --git a/bin/hafas b/bin/hafas
index 5c57d3e..d7dc9d3 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -3,7 +3,7 @@ use strict;
use warnings;
use 5.014;
-our $VERSION = '0.08';
+our $VERSION = '0.10';
use utf8;
use DateTime;
@@ -70,17 +70,29 @@ GetOptions(
) or show_help(1);
if ($list_services) {
- printf( "%-40s %-14s %s\n\n", 'operator', 'abbr. (-s)', 'languages (-l)' );
+ printf(
+ "%-40s %-14s %-15s %s\n\n",
+ 'operator', 'abbr. (-s)', 'languages (-l)',
+ 'time zone'
+ );
for my $service ( Travel::Routing::DE::HAFAS::get_services() ) {
+ if ( $service->{shortname} eq 'DB' ) {
+ next;
+ }
printf(
- "%-40s %-14s %s\n",
- @{$service}{qw(name shortname)},
- join( q{ }, @{ $service->{languages} // [] } )
+ "%-40s%1s %-14s %-15s %s\n",
+ $service->{name},
+ $service->{geoip_lock} ? q{!} : q{ },
+ $service->{shortname},
+ join( q{ }, @{ $service->{languages} // [] } ),
+ $service->{time_zone} // q{},
);
}
exit 0;
}
+$service //= 'VRN';
+
parse_mot_options();
my ( $from_stop, @via_stops ) = @ARGV;
@@ -164,7 +176,7 @@ sub parse_mot_options {
for my $type ( split( qr{,}, $types ) ) {
if ( $type eq 'help' or $type eq 'list' or $type eq q{?} ) {
- $service //= 'DB';
+ $service //= 'VRN';
my $desc = Travel::Routing::DE::HAFAS::get_service($service);
if ($desc) {
my @mots = @{ $desc->{productbits} };
@@ -291,7 +303,7 @@ sub show_message {
}
if ( my $err = $hafas->errstr ) {
- say STDERR "Request error: ${err}";
+ say STDERR "Backend error: ${err}";
if ( $hafas->errcode ) {
if ( $hafas->errcode eq 'H730' or $hafas->errcode eq 'LOCATION' ) {
show_similar_stops();
@@ -489,7 +501,7 @@ __END__
=head1 NAME
-hafas - Interface to HAFAS (e.g. Deutsche Bahn) itinerary services
+hafas - Interface to HAFAS-based itinerary services
=head1 SYNOPSIS
@@ -498,13 +510,12 @@ B<hafas> [B<-d> I<date>] [B<-t> I<time>] [B<-m> I<motlist>]
=head1 VERSION
-version 0.08
+version 0.10
=head1 DESCRIPTION
B<hafas> is a command line client for HAFAS-based public transit itinerary
-services, e.g. the one operated by Deutsche Bahn. It requests connections
-between two stops and prints the results.
+services. It requests connections between two stops and prints the results.
=head1 OPTIONS
@@ -549,6 +560,10 @@ Note that requesting an invalid/unsupported language may lead to garbage output.
List known HAFAS installations and exit. Use B<-s>|B<--service> to select an
operator from this list for a HAFAS request.
+Instances marked with an exclamation mark (C<< ! >>) are behind a GeoIP filter
+and may need a proxy to work. See the documentation of get_active_service in
+Travel::Status::DE::HAFAS(3pm) for details.
+
=item B<-m>, B<--mot> I<motlist>
By default, B<hafas> considers all modes of transport for routing. With
@@ -563,8 +578,8 @@ The I<mot> types depend on the used service. Use C<< -m help >> to list them.
=item B<-s>, B<--service> I<service>
-Use the API provided by I<service> for routing; defaults to DB (Deutsche Bahn).
-See B<--list> for a list of known services.
+Use the API provided by I<service> for routing; defaults to VRN
+(Verkehrsverbund Rhein-Neckar). See B<--list> for a list of known services.
=item B<-t>, B<--time>, B<--depart> I<hh>:I<mm>
@@ -618,7 +633,7 @@ None.
=head1 BUGS AND LIMITATIONS
-The non-default services (anything other than DB) are not well-tested.
+Some services are not well-tested.
=head1 AUTHOR