summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/hafas-m11
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm9
2 files changed, 20 insertions, 0 deletions
diff --git a/bin/hafas-m b/bin/hafas-m
index f279b04..dc053c9 100755
--- a/bin/hafas-m
+++ b/bin/hafas-m
@@ -6,6 +6,7 @@ use 5.010;
our $VERSION = '1.05';
use Getopt::Long qw(:config no_ignore_case);
+use List::MoreUtils qw(uniq);
use List::Util qw(first max);
use Travel::Status::DE::HAFAS;
@@ -58,6 +59,16 @@ for my $type ( split( qr{,}, $types ) ) {
}
}
+if ( $train_type{help} or $train_type{list} or $train_type{'?'} ) {
+ my @mots
+ = @{ Travel::Status::DE::HAFAS::get_service($service)->{productbits} };
+ @mots = grep { $_ ne 'x' } @mots;
+ @mots = uniq @mots;
+ @mots = sort @mots;
+ say join( "\n", @mots );
+ exit 0;
+}
+
my $status = Travel::Status::DE::HAFAS->new(
date => $date,
language => $language,
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index b47c2fe..8cf03e3 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -237,7 +237,16 @@ sub get_services {
return @services;
}
+# static
sub get_service {
+ my ($service) = @_;
+
+ $service //= 'DB';
+
+ return $hafas_instance{$service};
+}
+
+sub get_active_service {
my ($self) = @_;
return %{ $hafas_instance{ $self->{active_service} } };