Browse files

Improve error messages on failed switch()

  • Loading branch information...
1 parent 31a02bf commit 61437755483587ef534de8a6387002e65e6891ae @tadzik committed Feb 17, 2014
Showing with 7 additions and 6 deletions.
  1. +7 −6 bin/rakudobrew
View
13 bin/rakudobrew
@@ -81,15 +81,16 @@ sub switch {
}
opendir(my $dh, $prefix);
my @match = grep { /$impl/ } list();
- my $ambiguous;
- ($impl, $ambiguous) = @match;
- if (not $ambiguous) {
- say "Switching to $impl";
- spurt("$prefix/CURRENT", $impl);
+ my ($matched, $ambiguous) = @match;
+ if ($matched and not $ambiguous) {
+ say "Switching to $matched";
+ spurt("$prefix/CURRENT", $matched);
rehash();
- } else {
+ } elsif (@match) {
say "Sorry, I'm not sure if you mean:";
say $_ for @match;
+ } else {
+ say "Sorry, I have no idea what '$impl' is";
}
}

0 comments on commit 6143775

Please sign in to comment.