[Bps-public-commit] r16073 - in Prophet/branches/dispatcher: . lib/Prophet
sartak at bestpractical.com
sartak at bestpractical.com
Thu Sep 25 16:44:50 EDT 2008
Author: sartak
Date: Thu Sep 25 16:44:49 2008
New Revision: 16073
Removed:
Prophet/branches/dispatcher/lib/Prophet/CLI/Command/Delete.pm
Modified:
Prophet/branches/dispatcher/ (props changed)
Prophet/branches/dispatcher/lib/Prophet/CLI.pm
Log:
r72484 at onn: sartak | 2008-09-25 16:43:44 -0400
Move edit_record into CLI
Modified: Prophet/branches/dispatcher/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLI.pm (original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLI.pm Thu Sep 25 16:44:49 2008
@@ -7,7 +7,7 @@
use Prophet::CLI::Dispatcher;
use Prophet::CLIContext;
-use List::Util 'first';
+use Params::Validate;
has app_class => (
is => 'rw',
@@ -155,7 +155,7 @@
my %args = @_;
my $hash = $args{'hash'};
my @ordering = @{ $args{'ordering'} || [] };
- my $record = $self->_get_record_object;
+ my $record = $self->context->_get_record_object;
my $do_not_edit = $record->can('props_not_to_edit') ? $record->props_not_to_edit : '';
if (@ordering) {
@@ -232,6 +232,31 @@
return \%props;
}
+sub edit_record {
+ my $self = shift;
+ my $record = shift;
+
+ my $props = $record->get_props;
+
+ # don't feed in existing values if we're not interactively editing
+ my $defaults = $self->context->has_arg('edit') ? $props : undef;
+
+ my @ordering = ( );
+ # we want props in $record->props_to_show to show up in the editor if --edit
+ # is supplied too
+ if ($record->can('props_to_show') && $self->context->has_arg('edit')) {
+ @ordering = $record->props_to_show;
+ for (@ordering) {
+ $props->{$_} = '' if !exists($props->{$_});
+ }
+ }
+
+ return $self->edit_props(
+ arg => 'edit',
+ defaults => $defaults,
+ ordering => \@ordering,
+ );
+}
__PACKAGE__->meta->make_immutable;
no Moose;
More information about the Bps-public-commit
mailing list