| 1 | package App::SD::CLI::Command::Ticket::Comment::Update; | ||
| 2 | use Any::Moose; | ||
| 3 | |||
| 4 | extends 'Prophet::CLI::Command::Update'; | ||
| 5 | |||
| 6 | override run => sub { | ||
| 7 | my $self = shift; | ||
| 8 | |||
| 9 | $self->print_usage if $self->has_arg('h'); | ||
| 10 | |||
| 11 | $self->require_uuid; | ||
| 12 | |||
| 13 | my $record = $self->_load_record; | ||
| 14 | my @prop_set = $self->prop_set; | ||
| 15 | |||
| 16 | # we don't want to do prop: value editing by default for comments since | ||
| 17 | # it's just a blob of text | ||
| 18 | if (!@prop_set || $self->has_arg('edit')) { | ||
| 19 | my $updated_comment = $self->edit_text($record->prop('content')); | ||
| 20 | $record->set_prop(name => 'content', value => $updated_comment); | ||
| 21 | print "Updated comment " . $record->luid . " (" . $record->uuid . ")\n"; | ||
| 22 | } else { | ||
| 23 | super(); | ||
| 24 | } | ||
| 25 | }; | ||
| 26 | |||
| 27 | __PACKAGE__->meta->make_immutable; | ||
| 28 | no Any::Moose; | ||
| 29 | |||
| 30 | 1; |