[Bps-public-commit] Prophet branch, master, updated. 0.742-9-g746a38a

Shawn Moore sartak at bestpractical.com
Fri Jun 18 16:19:48 EDT 2010


The branch, master has been updated
       via  746a38aa77f8b524f3eb342e1fa15e788e59f1d3 (commit)
      from  cce1d8a075e07051131435bf8baf6ce9754ddff4 (commit)

Summary of changes:
 lib/Prophet/CLI/Dispatcher/Rule/RecordId.pm |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 746a38aa77f8b524f3eb342e1fa15e788e59f1d3
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jun 18 16:20:50 2010 -0400

    Tab completion for RecordId rules

diff --git a/lib/Prophet/CLI/Dispatcher/Rule/RecordId.pm b/lib/Prophet/CLI/Dispatcher/Rule/RecordId.pm
index 06eb914..a5102d0 100644
--- a/lib/Prophet/CLI/Dispatcher/Rule/RecordId.pm
+++ b/lib/Prophet/CLI/Dispatcher/Rule/RecordId.pm
@@ -9,6 +9,32 @@ has '+regex' => (
     default => sub { qr/^$Prophet::CLIContext::ID_REGEX$/i },
 );
 
+has type => (
+    is  => 'ro',
+    isa => 'Str',
+);
+
+sub complete {
+    my $self = shift;
+    my $path = shift->path;
+
+    my $handle = $self->cli->app_handle->handle;
+
+    my @types = $self->type || @{ $handle->list_types };
+
+    my @ids;
+    for my $type (@types) {
+        push @ids,
+            grep { substr($_, 0, length($path)) eq $path }
+            map { ($_->uuid, $_->luid) }
+            @{ $handle->list_records(
+                type         => $type,
+                record_class => $self->cli->record_class,
+            ) };
+    }
+    return @ids;
+}
+
 __PACKAGE__->meta->make_immutable;
 no Any::Moose;
 

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



More information about the Bps-public-commit mailing list