Commit 5fc7f99b authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

bin/efa: warn when -a and -t are used at the same time

parent 19e49757
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ GetOptions(
		auto-url|discover-and-print|A
		bike|b
		date|d=s
		depart=s
		depart|time|t=s
		devmode
		discover|D
		efa-url|u=s
@@ -223,7 +223,6 @@ GetOptions(
		prefer|P=s
		proximity|p:10
		service|s=s
		time|t=s
		timeout=i
		to=s@{2}
		version|v
@@ -241,6 +240,13 @@ if ( $opt->{list} ) {
	exit 0;
}

if ( $opt->{arrive} and $opt->{depart} ) {
	print STDERR 'Note: The options -a/--arrive and -t/--time/--depart are'
	  . " mutually exclusive\n"
	  . "      Discarding the --arrive option\n\n";
	delete $opt->{arrive};
}

if ( not( @from and @to ) ) {
	if ( @ARGV == 4 ) {
		( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV;
@@ -304,7 +310,7 @@ if ( $opt->{discover} or $opt->{'auto-url'} ) {
				via => ( @via ? [ @via, $via_type ] : undef ),

				arrival_time   => $opt->{arrive},
				departure_time => $opt->{depart} // $opt->{time},
				departure_time => $opt->{depart},
				date           => $opt->{date},
				exclude        => $opt->{exclude},
				train_type     => $opt->{include},
@@ -345,7 +351,7 @@ else {
			via => ( @via ? [ @via, $via_type ] : undef ),

			arrival_time   => $opt->{arrive},
			departure_time => $opt->{depart} // $opt->{time},
			departure_time => $opt->{depart},
			date           => $opt->{date},
			exclude        => $opt->{exclude},
			train_type     => $opt->{include},