summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-29 19:36:29 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-29 19:36:29 +0200
commitbac92f915ff58055e9c22337a7eb0f64fa03c440 (patch)
tree146fe42c89ef9f2955ab1ca5eabf3055f4665ad9
parentc81c7d4d68f176c7c366709d070e3c5a43f47d5e (diff)
hafas-m: add -n / --num-results option
-rwxr-xr-xbin/hafas-m37
1 files changed, 22 insertions, 15 deletions
diff --git a/bin/hafas-m b/bin/hafas-m
index ea8471f..43ad111 100755
--- a/bin/hafas-m
+++ b/bin/hafas-m
@@ -17,7 +17,8 @@ use Travel::Status::DE::HAFAS;
my ( $date, $time, $language );
my $arrivals;
my $show_jid;
-my $types = q{};
+my $num_results = 30;
+my $types = q{};
my $developer_mode;
my $via;
my ( $json_output, $raw_json_output );
@@ -35,20 +36,21 @@ my $output_bold = -t STDOUT ? "\033[1m" : q{};
my $output_reset = -t STDOUT ? "\033[0m" : q{};
GetOptions(
- 'a|arrivals' => \$arrivals,
- 'd|date=s' => \$date,
- 'h|help' => sub { show_help(0) },
- 'j|with-jid' => \$show_jid,
- 'l|language=s' => \$language,
- 'm|mot=s' => \$types,
- 's|service=s' => \$service,
- 't|time=s' => \$time,
- 'v|via=s' => \$via,
- 'V|version' => \&show_version,
- 'devmode' => \$developer_mode,
- 'json' => \$json_output,
- 'raw-json' => \$raw_json_output,
- 'list' => \$list_services,
+ 'a|arrivals' => \$arrivals,
+ 'd|date=s' => \$date,
+ 'h|help' => sub { show_help(0) },
+ 'j|with-jid' => \$show_jid,
+ 'l|language=s' => \$language,
+ 'm|mot=s' => \$types,
+ 'n|num-results=s' => \$num_results,
+ 's|service=s' => \$service,
+ 't|time=s' => \$time,
+ 'v|via=s' => \$via,
+ 'V|version' => \&show_version,
+ 'devmode' => \$developer_mode,
+ 'json' => \$json_output,
+ 'raw-json' => \$raw_json_output,
+ 'list' => \$list_services,
) or show_help(1);
@@ -79,6 +81,7 @@ my %opt = (
developer_mode => $developer_mode,
service => $service,
language => $language,
+ results => $num_results,
);
if ( $opt{station} =~ m{ ^ (?<lat> [0-9.]+ ) : (?<lon> [0-9].+ ) $ }x ) {
@@ -785,6 +788,10 @@ To show them exclusively, set I<motlist> to I<mot1>,I<mot2>,...
The I<mot> types depend on the used service. Use C<< -m help >> to list them.
+=item B<-n>, B<--num-results> I<count>
+
+Request up to I<count> results. Default: 30.
+
=item B<--raw-json>
Print unprocessed HAFAS response as JSON and exit.