[Bps-public-commit] r14092 - in Prophet/trunk: . lib/Prophet/CLI/Command

sartak at bestpractical.com sartak at bestpractical.com
Mon Jul 14 17:38:48 EDT 2008


Author: sartak
Date: Mon Jul 14 17:38:48 2008
New Revision: 14092

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI/Command/Show.pm
   Prophet/trunk/lib/Prophet/Record.pm

Log:
 r64242 at onn:  sartak | 2008-07-14 17:38:41 -0400
 Add a --verbose option to Show, which shows every other prop


Modified: Prophet/trunk/lib/Prophet/CLI/Command/Show.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Show.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Show.pm	Mon Jul 14 17:38:48 2008
@@ -7,7 +7,10 @@
     my $self = shift;
 
     my $record = $self->_load_record;
-    print $record->stringify_props(batch => $self->has_arg('batch'));
+    print $record->stringify_props(
+        batch   => $self->has_arg('batch'),
+        verbose => $self->has_arg('verbose'),
+    );
 }
 
 __PACKAGE__->meta->make_immutable;

Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Mon Jul 14 17:38:48 2008
@@ -387,6 +387,14 @@
     my @show_props;
     if ($self->can('props_to_show')) {
         @show_props = $self->props_to_show(\%args);
+
+        # if they ask for verbosity, then display all the other fields
+        # after the fields that our subclass wants to show
+        if ($args{verbose}) {
+            my %already_shown = map { $_ => 1 } @show_props;
+            push @show_props, grep { !$already_shown{$_} }
+                              keys %$props;
+        }
     }
     else {
         @show_props = ('id', keys %$props);



More information about the Bps-public-commit mailing list