[Bps-public-commit] r16453 - in Prophet/branches/class-dispatch: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Oct 21 15:47:11 EDT 2008


Author: sartak
Date: Tue Oct 21 15:47:11 2008
New Revision: 16453

Modified:
   Prophet/branches/class-dispatch/   (props changed)
   Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm

Log:
 r74322 at onn:  sartak | 2008-10-21 15:47:05 -0400
 run -> redispatch
 command -> run


Modified: Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm
==============================================================================
--- Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm	(original)
+++ Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm	Tue Oct 21 15:47:11 2008
@@ -3,19 +3,26 @@
 use Moose;
 with 'Prophet::CLI::Parameters';
 
-on [ ['create', 'new'] ]         => command("Create");
-on [ ['show', 'display'] ]       => command("Show");
-on [ ['update', 'edit'] ]        => command("Update");
-on [ ['delete', 'del', 'rm'] ]   => command("Delete");
-on [ ['search', 'list', 'ls' ] ] => command("Search");
-
-on merge   => command("Merge");
-on pull    => command("Pull");
-on publish => command("Publish");
-on server  => command("Server");
-on config  => command("Config");
-on log     => command("Log");
-on shell   => command("Shell");
+# "ticket display $ID" -> "ticket display --id=$ID"
+on qr{^ (.*) \s+ ( \d+ | [A-Z0-9]{36} ) $ }x => sub {
+    my $self = shift;
+    $self->context->set_arg(id => $2);
+    redispatch($1, $self, @_);
+};
+
+on [ ['create', 'new'] ]         => run("Create");
+on [ ['show', 'display'] ]       => run("Show");
+on [ ['update', 'edit'] ]        => run("Update");
+on [ ['delete', 'del', 'rm'] ]   => run("Delete");
+on [ ['search', 'list', 'ls' ] ] => run("Search");
+
+on merge   => run("Merge");
+on pull    => run("Pull");
+on publish => run("Publish");
+on server  => run("Server");
+on config  => run("Config");
+on log     => run("Log");
+on shell   => run("Shell");
 
 on export => sub {
     my $self = shift;
@@ -29,7 +36,7 @@
 
     $self->context->set_arg(from => $self->cli->app_handle->default_replica_type.":file://".$self->cli->handle->fs_root);
     $self->context->set_arg(db_uuid => $self->cli->handle->db_uuid);
-    run('merge', $self, @_);
+    redispatch('merge', $self, @_);
 };
 
 on history => sub {
@@ -41,7 +48,7 @@
     print $record->history_as_string;
 };
 
-sub command {
+sub run {
     my $name = shift;
 
     return sub {



More information about the Bps-public-commit mailing list