From 5fc7f99bf99c5a90cc201abf0b91671c89b7d4d3 Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Mon, 22 Jun 2015 23:48:10 +0200
Subject: [PATCH] bin/efa: warn when -a and -t are used at the same time

---
 bin/efa | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/bin/efa b/bin/efa
index 3f0822c..a5b5403 100755
--- a/bin/efa
+++ b/bin/efa
@@ -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},
-- 
GitLab