[Bps-public-commit] SD branch, config-gitlike, updated. 395333503b67d565e0f6611a2a61436b6723fe15

spang at bestpractical.com spang at bestpractical.com
Fri Jun 26 16:57:31 EDT 2009


The branch, config-gitlike has been updated
       via  395333503b67d565e0f6611a2a61436b6723fe15 (commit)
       via  dc543e9025bd00ead02987240a4b82f384867bfd (commit)
       via  1bee4fd1068661c8364b1d5293ba62b12c67e161 (commit)
       via  fd8ecfbb884800ac8b8175c3ddbe789d1e277b76 (commit)
      from  0cf13ad324b39026f4273451f9ec93620a55dcca (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Log.pm           |    2 +-
 lib/App/SD/CLI/Command/Ticket/Show.pm   |    2 +-
 lib/App/SD/CLI/Command/Ticket/Update.pm |    4 ++-
 lib/App/SD/CLI/Dispatcher.pm            |   46 ++++++++++++++++++++-----------
 4 files changed, 35 insertions(+), 19 deletions(-)

- Log -----------------------------------------------------------------
commit fd8ecfbb884800ac8b8175c3ddbe789d1e277b76
Author: Christine Spang <spang at bestpractical.com>
Date:   Fri Jun 26 22:40:42 2009 +0300

    Dispatcher logic for grabbing IDs from primary commands for certain commands

diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index 7f17855..828172b 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -2,6 +2,7 @@
 package App::SD::CLI::Dispatcher;
 use Prophet::CLI::Dispatcher -base;
 use Any::Moose;
+require Prophet::CLIContext;
 
 Prophet::CLI::Dispatcher->add_command_prefix('App::SD::CLI::Command');
 
@@ -13,13 +14,14 @@ rewrite [ ['about', 'copying'] ] => sub { "help $1" };
 
 on qr'^(?!help)' => sub {
     my $self = shift;
-    my $cmd = $_; 
+    my $cmd = $_;
+
     if ($self->context->has_arg('help')) {
         run("help $cmd", $self, @_);
-    } else { 
+    }
+    else {
         next_rule;
-        }
-
+    }
 };
 
 under help => sub {
@@ -85,22 +87,30 @@ on qr/^(\w+)\s+tickets?(.*)$/ => sub {
 };
 
 under ticket => sub {
+    # all these might possibly have IDs tacked onto the end
+    on
+    qr/^((?:comment\s+)?update|edit|show|display|delete|del|rm|history|claim|take|resolve|close) $Prophet::CLIContext::ID_REGEX$/i => sub {
+        my $self = shift;
+        $self->context->set_id_from_primary_commands;
+        run("ticket $1", $self, @_);
+    };
+
+    on [ [ 'new'    , 'create' ] ]    => run_command('Ticket::Create');
+    on [ [ 'show'   , 'display' ] ]   => run_command('Ticket::Show');
+    on [ [ 'update' , 'edit' ] ]      => run_command('Ticket::Update');
     on [ [ 'search', 'list', 'ls' ] ] => run_command('Ticket::Search');
-    on [ [ 'new',    'create' ] ]  => run_command('Ticket::Create');
-    on [ [ 'show',   'display' ] ] => run_command('Ticket::Show');
-    on [ [ 'update', 'edit' ] ]    => run_command('Ticket::Update');
+    on details  => run_command('Ticket::Details');
     on basics   => run_command('Ticket::Basics');
-    on comments => run_command('Ticket::Comments');
     on comment  => run_command('Ticket::Comment');
-    on details  => run_command('Ticket::Details');
+    on comments => run_command('Ticket::Comments');
 
     under [ [ 'give', 'assign' ] ] => sub {
-        on [qr/^(?:\d+|[0-9a-zA-Z\-\_]{22,24}|[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})$/, qr/^\S+$/] => sub {
+        on [qr/^$Prophet::CLIContext::ID_REGEX$/, qr/^\S+$/] => sub {
             my $self = shift;
             my ($id, $owner) = ($1, $2);
 
-            $self->context->set_arg(id    => $id);
-            $self->context->set_arg(type    => 'ticket');
+            $self->context->set_arg(id     => $id);
+            $self->context->set_arg(type   => 'ticket');
             $self->context->set_prop(owner => $owner);
             $self->context->set_type_and_uuid;
             run('ticket update', $self, @_);
@@ -131,12 +141,17 @@ under ticket => sub {
     };
 
     under comment => sub {
-        on [ [ 'new', 'create' ] ] => run_command('Ticket::Comment::Create');
-        on [ [ 'update', 'edit' ] ] => run_command('Ticket::Comment::Update');
+        on create => run_command('Ticket::Comment::Create');
+        on update => run_command('Ticket::Comment::Update');
     };
 
     under attachment => sub {
         on create => run_command('Ticket::Attachment::Create');
+        on [ [ 'create', 'new' ], qr/^$Prophet::CLIContext::ID_REGEX$/ ] => sub {
+            my $self = shift;
+            $self->context->set_id_from_primary_commands;
+            run('ticket attachment create', $self, @_);
+        };
         on search => run_command('Ticket::Attachment::Search');
     };
 

commit 1bee4fd1068661c8364b1d5293ba62b12c67e161
Author: Christine Spang <spang at bestpractical.com>
Date:   Fri Jun 26 22:42:32 2009 +0300

    Change some UI UUIDs to display friendly names instead

diff --git a/lib/App/SD/CLI/Command/Log.pm b/lib/App/SD/CLI/Command/Log.pm
index 3f3aef1..594f6c1 100644
--- a/lib/App/SD/CLI/Command/Log.pm
+++ b/lib/App/SD/CLI/Command/Log.pm
@@ -22,7 +22,7 @@ sub handle_changeset {
                 $c->created,
                 ( $c->creator || '(unknown)' ),
                 $c->original_sequence_no,
-                $c->original_source_uuid
+                $self->config->display_name_for_uuid($c->original_source_uuid)
                 ;
             }
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Show.pm b/lib/App/SD/CLI/Command/Ticket/Show.pm
index a3f6078..74e9b84 100644
--- a/lib/App/SD/CLI/Command/Ticket/Show.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Show.pm
@@ -84,7 +84,7 @@ sub show_history_entry {
     $self->history_entry_header(
          $changeset->creator,
         $changeset->created,
-        $changeset->original_sequence_no,
+        $self->config->display_name_for_uuid($changeset->original_sequence_no),
         $changeset->original_source_uuid);
 
     print $body;

commit dc543e9025bd00ead02987240a4b82f384867bfd
Author: Christine Spang <spang at bestpractical.com>
Date:   Fri Jun 26 22:43:10 2009 +0300

    Some small formatting cleanup

diff --git a/lib/App/SD/CLI/Command/Ticket/Update.pm b/lib/App/SD/CLI/Command/Ticket/Update.pm
index b6eb6cc..479976b 100644
--- a/lib/App/SD/CLI/Command/Ticket/Update.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Update.pm
@@ -13,9 +13,11 @@ sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  a => 'all-props'  };
 # allowing the creation of a new comment in the process
 override run => sub {
     my $self = shift;
+
     $self->require_uuid;
     my $record = $self->_load_record;
-   return super() if ($self->context->prop_names && !$self->has_arg('edit'));
+
+    return super() if ($self->context->prop_names && !$self->has_arg('edit'));
     my $template_to_edit = $self->create_record_template($record);
 
     my $done = 0;

commit 395333503b67d565e0f6611a2a61436b6723fe15
Author: Christine Spang <spang at bestpractical.com>
Date:   Fri Jun 26 23:50:46 2009 +0300

    Note what this rule is for.

diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index 828172b..bddd0ca 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -71,10 +71,9 @@ on qr'.*' => sub {
     exit 1;
 };
 
-
-
 on browser => run_command('Browser');
 
+# allow doing some things backwards -- e.g. 'list tickets' etc.
 on qr/^(\w+)\s+tickets?(.*)$/ => sub {
     my $self = shift;
     my $primary = $1;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list