summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-06-06 15:45:51 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-06-06 15:45:51 +0200
commit8413c8a433a7f97aba2f257140ed53f46eda6885 (patch)
tree4f8aa94671fe7e8c0e35be3fd26297945926dca7
parent2cfe5f52e1f00a1732cc996c0ab30d0506cfb343 (diff)
Slightly change option error messages
-rwxr-xr-xbin/efa12
-rw-r--r--test/50-efa.t16
2 files changed, 13 insertions, 15 deletions
diff --git a/bin/efa b/bin/efa
index 60dfb62..764cfa4 100755
--- a/bin/efa
+++ b/bin/efa
@@ -97,7 +97,7 @@ sub opt_time {
my (undef, $time) = @_;
if ($time !~ /^ [0-2]? \d : [0-5]? \d $/x) {
- die("Invalid argument. Usage: --time HH:MM\n");
+ die("time: Invalid argument. Use HH:MM\n");
}
@post{'itdTimeHour', 'itdTimeMinute'} = split(/:/, $time);
}
@@ -106,7 +106,7 @@ sub opt_date {
my (undef, $date) = @_;
if ($date !~ /^ [0-3]? \d \. [01]? \d \. (?: \d{4} )? $/x) {
- die("Invalid argument: Usage: --date DD.MM.[YYYY]\n");
+ die("date: Invalid argument: Use DD.MM.[YYYY]\n");
}
@post{'itdDateDay', 'itdDateMonth', 'itdDateYear'} = split(/\./, $date);
$post{itdDateYear} //= (localtime(time))[5] + 1900;
@@ -130,7 +130,7 @@ sub opt_exclude {
}
}
if (not $ok) {
- die("Invalid argument. See manpage for --exclude usage\n");
+ die("exclude: Invalid argument.\n");
}
}
@@ -147,7 +147,7 @@ sub opt_prefer {
when ('nowait') { $post{routeType} = 'LEASTINTERCHANGE' }
when ('nowalk') { $post{routeType} = 'LEASTWALKING' }
default {
- die("Invalid argument. Usage: --prefer speed|nowait|nowalk\n");
+ die("prefer: Invalid argument. Use speed|nowait|nowalk\n");
}
}
}
@@ -165,7 +165,7 @@ sub opt_include {
when ('ice') { $post{lineRestriction} = 400 }
when (/\d+/) { $post{lineRestriction} = $include }
default {
- die("Invalid argument. Usage: --include local|ic|ice\n");
+ die("include: Invalid argument. Use local|ic|ice\n");
}
}
}
@@ -177,7 +177,7 @@ sub opt_walk_speed {
$post{changeSpeed} = $walk_speed;
}
else {
- die("Invalid argument. Uaseg: --walk-speed normal|fast|slow\n");
+ die("walk-speed: Invalid argument. Use normal|fast|slow\n");
}
}
diff --git a/test/50-efa.t b/test/50-efa.t
index 575481d..1425696 100644
--- a/test/50-efa.t
+++ b/test/50-efa.t
@@ -14,15 +14,13 @@ my $EMPTY = '';
my $re_usage = qr{Insufficient to/from arguments, see \S*efa --help for usage};
my $re_version = qr{\S*efa version \S+};
-my $err_exclude = "Invalid argument. See manpage for --exclude usage\n";
-my $err_prefer = "Invalid argument. Usage: --prefer speed|nowait|nowalk\n";
-my $err_include = "Invalid argument. Usage: --include local|ic|ice\n";
-my $err_time = "Invalid argument. Usage: --time HH:MM\n";
-my $err_date = "Invalid argument: Usage: --date DD.MM.[YYYY]\n";
-my $err_common = "Please see bin/efa --help\n";
-
-my $err_walk_speed
- = "Invalid argument. Uaseg: --walk-speed normal|fast|slow\n";
+my $err_exclude = "exclude: Invalid argument.\n";
+my $err_prefer = "prefer: Invalid argument. Use speed|nowait|nowalk\n";
+my $err_include = "include: Invalid argument. Use local|ic|ice\n";
+my $err_time = "time: Invalid argument. Use HH:MM\n";
+my $err_date = "date: Invalid argument: Use DD.MM.[YYYY]\n";
+my $err_walk_speed = "walk-speed: Invalid argument. Use normal|fast|slow\n";
+my $err_common = "Please see bin/efa --help\n";
# Usage on invalid invocation
my $cmd = Test::Command->new(cmd => "$efa");