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

sartak at bestpractical.com sartak at bestpractical.com
Mon Jul 21 20:07:36 EDT 2008


Author: sartak
Date: Mon Jul 21 20:07:36 2008
New Revision: 14349

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/Makefile.PL
   Prophet/trunk/lib/Prophet/CLI/Command/Search.pm
   Prophet/trunk/lib/Prophet/Record.pm

Log:
 r64695 at onn:  sartak | 2008-07-21 20:07:17 -0400
 Add an --html option to list/search


Modified: Prophet/trunk/Makefile.PL
==============================================================================
--- Prophet/trunk/Makefile.PL	(original)
+++ Prophet/trunk/Makefile.PL	Mon Jul 21 20:07:36 2008
@@ -36,6 +36,11 @@
         'HTTP::Server::Simple'
     ],
 
+    'HTML display' => [
+        -default => 1,
+        'Template::Declare', # Template::Declare::Tags
+    ],
+
 
     'Subversion replica support' => [
         -default => 0,

Modified: Prophet/trunk/lib/Prophet/CLI/Command/Search.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Search.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Search.pm	Mon Jul 21 20:07:36 2008
@@ -45,6 +45,7 @@
         return sub {1}
     }
 }
+
 sub run {
     my $self = shift;
 
@@ -52,6 +53,25 @@
     my $search_cb = $self->get_search_callback();
     $records->matching($search_cb);
 
+    my $display_method = $self->has_arg('html')
+                       ? 'display_html'
+                       : 'display_terminal';
+    $self->$display_method($records);
+}
+
+sub display_html {
+    my $self = shift;
+    my $records = shift;
+
+    require Prophet::Server::View;
+    Template::Declare->init(roots => ['Prophet::Server::View']);
+    print Template::Declare->show('record_table' => $records);
+}
+
+sub display_terminal {
+    my $self = shift;
+    my $records = shift;
+
     for ( sort { $a->luid <=> $b->luid } $records->items ) {
             print $_->format_summary . "\n";
     }

Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Mon Jul 21 20:07:36 2008
@@ -360,7 +360,8 @@
 sub _default_summary_format { 'No summary format defined for this record type' }
 
 sub format_summary {
-    my $self   = shift;
+    my $self = shift;
+    my $html = shift;
 
     my $configured_format =
          $self->app_handle->config->get('summary_format_'.$self->type) 



More information about the Bps-public-commit mailing list