summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hafas43
1 files changed, 27 insertions, 16 deletions
diff --git a/bin/hafas b/bin/hafas
index 3838373..2a3aed5 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -20,6 +20,7 @@ my $types = q{};
my $developer_mode;
my ( $json_output, $raw_json_output );
my $show_full_route;
+my $exclude_infeasible;
my ( $list_services, $service );
my ( @excluded_mots, @exclusive_mots );
my $max_change = undef;
@@ -46,22 +47,23 @@ my $output_bold = -t STDOUT ? "\033[1m" : q{};
my $output_reset = -t STDOUT ? "\033[0m" : q{};
GetOptions(
- 'a|arrive=s' => sub { $arrival = 1; $time = $_[1] },
- 'c|max-change=s' => \$max_change,
- 'C|change-time=s' => \$min_change_time,
- 'd|date=s' => \$date,
- 'h|help' => sub { show_help(0) },
- 'f|full-route' => \$show_full_route,
- 'l|language=s' => \$language,
- 'm|mot=s' => \$types,
- 's|service=s' => \$service,
- 't|time|depart=s' => \$time,
- 'v|verbose+' => \$verbosity,
- 'V|version' => \&show_version,
- 'devmode' => \$developer_mode,
- 'json' => \$json_output,
- 'raw-json' => \$raw_json_output,
- 'list' => \$list_services,
+ 'a|arrive=s' => sub { $arrival = 1; $time = $_[1] },
+ 'c|max-change=s' => \$max_change,
+ 'C|change-time=s' => \$min_change_time,
+ 'd|date=s' => \$date,
+ 'h|help' => sub { show_help(0) },
+ 'f|full-route' => \$show_full_route,
+ 'l|language=s' => \$language,
+ 'm|mot=s' => \$types,
+ 's|service=s' => \$service,
+ 't|time|depart=s' => \$time,
+ 'x|exclude-infeasible' => \$exclude_infeasible,
+ 'v|verbose+' => \$verbosity,
+ 'V|version' => \&show_version,
+ 'devmode' => \$developer_mode,
+ 'json' => \$json_output,
+ 'raw-json' => \$raw_json_output,
+ 'list' => \$list_services,
) or show_help(1);
@@ -338,6 +340,9 @@ for my $res ( $hafas->connections ) {
}
if ( $cancelled or $negative_transfer or $part_cancelled ) {
+ if ($exclude_infeasible) {
+ next;
+ }
printf(
"%s (%02d:%02d) %s %s %s\n",
$res->dep->strftime('XX.XX. %H:%M'),
@@ -538,6 +543,12 @@ B<-v>) to 3 (B<-vvv>).
Show version information and exit.
+=item B<-x>, B<--exclude-infeasible>
+
+HAFAS responses include journeys that are infeasible e.g. due to delayed or
+cancelled trips. By default, B<hafas> displays those with an XX.XX. departure
+date. When this option is set, B<hafas> silently ignores them instead.
+
=back
=head1 EXIT STATUS