Author: bdonlan
Date: 2004-05-30 22:03:56 -0400 (Sun, 30 May 2004)
New Revision: 209

Modified:
   trunk/haver-client/lib/Haver/Client/Command.pm
Log:
Clarified ambigous/unknown command messages. Sometime in the future a proper
exception or handler should be called instead of die-ing, but it's better
than before.


Modified: trunk/haver-client/lib/Haver/Client/Command.pm
===================================================================
--- trunk/haver-client/lib/Haver/Client/Command.pm      2004-05-31 02:01:10 UTC 
(rev 208)
+++ trunk/haver-client/lib/Haver/Client/Command.pm      2004-05-31 02:03:56 UTC 
(rev 209)
@@ -45,10 +45,11 @@
        my ($me, $s) = @_;
        my ($cmd, $arg) = $me->parse($s);
 
-       $cmd = $me->resolve_command($cmd);
-       die "more than on possible meaning!" if not defined $cmd or ref $cmd;
+       my $result = $me->resolve_command($cmd);
+       die "Unknown command: $cmd" unless defined $result;
+       die "Ambigous command: $cmd\nPossible matches:\n" . join("\n", map { "- 
" } @$result) if ref $result;
+       $cmd = $result;
 
-
        if ($me->is_alias($cmd) and $cmd ne $me->{builtin_cmd}) {
                my @lines = $me->eval_text($me->{alias}{$cmd}, $arg);
                


Reply via email to