[Bps-public-commit] r14497 - in sd/trunk: . lib/App/SD/CLI/Command/Attachment

sartak at bestpractical.com sartak at bestpractical.com
Fri Jul 25 03:44:37 EDT 2008


Author: sartak
Date: Fri Jul 25 03:44:35 2008
New Revision: 14497

Modified:
   sd/trunk/   (props changed)
   sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm

Log:
 r65175 at onn:  sartak | 2008-07-25 03:42:45 -0400
 If the user exits their editor (or uses :wq with no content), then don't create the attachment or comment


Modified: sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Attachment/Create.pm	Fri Jul 25 03:44:35 2008
@@ -6,7 +6,13 @@
 
 before run => sub {
     my $self = shift;
-    $self->set_prop(content => $self->get_content(type => 'attachment'));
+
+    my $content = $self->get_content(type => 'attachment');
+
+    die "Aborted.\n"
+        if length($content) == 0;
+
+    $self->set_prop(content => $content);
 };
 
 __PACKAGE__->meta->make_immutable;

Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm	Fri Jul 25 03:44:35 2008
@@ -8,8 +8,14 @@
 # override args to feed in that ticket's uuid as an argument to the comment
 before run => sub {
     my $self = shift;
+
+    my $content = $self->get_content(type => 'comment', default_edit => 1);
+
+    die "Aborted.\n"
+        if length($content) == 0;
+
     $self->set_prop(ticket => $self->cli->uuid);
-    $self->set_prop(content => $self->get_content(type => 'comment', default_edit => 1));
+    $self->set_prop(content => $content);
 };
 
 __PACKAGE__->meta->make_immutable;



More information about the Bps-public-commit mailing list