Skip to content
Snippets Groups Projects
Commit de432ead authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add -m help / -m list support

parent 53a32113
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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} } };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment