[Bps-public-commit] r12222 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Sat May 10 22:13:35 EDT 2008


Author: sartak
Date: Sat May 10 22:13:35 2008
New Revision: 12222

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

Log:
 r55535 at onn:  sartak | 2008-05-10 22:13:29 -0400
 Allow --edit for Command::Create which will let you type in a YAML-like hash


Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Sat May 10 22:13:35 2008
@@ -236,8 +236,8 @@
     my $input = join "\n", map { "$_: $hash->{$_}\n" } keys %$hash;
     my $output = $self->edit_text($input);
 
-    my $filtered;
-    while ($output =~ m{^(\S+?):(.*)$}g) {
+    my $filtered = {};
+    while ($output =~ m{^(\S+?):(.*)$}mg) {
         $filtered->{$1} = $2;
     }
 
@@ -251,7 +251,16 @@
     my $self   = shift;
     my $record = $self->_get_record;
 
-    $record->create( props => $self->args );
+    my $props;
+    if (exists $self->args->{edit}) {
+        delete $self->args->{edit};
+        $props = $self->edit_hash($self->args);
+    }
+    else {
+        $props = $self->args;
+    }
+
+    $record->create( props => $props );
     if (!$record->uuid) {
         warn "Failed to create " . $record->record_type . "\n";
         return;



More information about the Bps-public-commit mailing list