[Bps-public-commit] r16432 - in Prophet/branches/dispatcher: lib/Prophet lib/Prophet/CLI
sartak at bestpractical.com
sartak at bestpractical.com
Tue Oct 21 12:20:32 EDT 2008
Author: sartak
Date: Tue Oct 21 12:20:32 2008
New Revision: 16432
Modified:
Prophet/branches/dispatcher/ (props changed)
Prophet/branches/dispatcher/lib/Prophet/CLI.pm
Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm
Log:
r74281 at onn: sartak | 2008-10-21 12:20:20 -0400
Have the "command not found" error be a check at the dispatch level, instead of a special rule. This means that apps can have rules that run after Prophet's
Modified: Prophet/branches/dispatcher/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLI.pm (original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLI.pm Tue Oct 21 12:20:32 2008
@@ -90,7 +90,13 @@
dispatching_on => $args,
);
- $dispatcher->run($command, $dispatcher);
+ my $dispatch = $dispatcher->dispatch($command);
+
+ if (!$dispatch->has_matches) {
+ die "The command you ran '$command' could not be found. Perhaps running '$0 help' would help?\n";
+ }
+
+ $dispatch->run($dispatcher);
}
=head2 invoke outhandle, ARGV_COMPATIBLE_ARRAY
Modified: Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm (original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm Tue Oct 21 12:20:32 2008
@@ -303,13 +303,6 @@
$self->display_collection($records);
};
-# catch-all. () makes sure we don't hit the annoying historical feature of
-# the empty regex meaning the last-used regex
-on qr/()/ => sub {
- my $self = shift;
- $self->fatal_error("The command you ran '$_' could not be found. Perhaps running '$0 help' would help?");
-};
-
sub fatal_error {
my $self = shift;
my $reason = shift;
More information about the Bps-public-commit
mailing list