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

sartak at bestpractical.com sartak at bestpractical.com
Tue Jul 29 11:09:10 EDT 2008


Author: sartak
Date: Tue Jul 29 11:09:04 2008
New Revision: 14589

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

Log:
 r65342 at onn:  sartak | 2008-07-29 11:08:47 -0400
 Have "ticket show 4" dwim and map to "ticket show --id=4"


Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Tue Jul 29 11:09:04 2008
@@ -194,6 +194,10 @@
     my @primary;
     push @primary, shift @ARGV while ( $ARGV[0] && $ARGV[0] =~ /^\w+$/ && $ARGV[0] !~ /^--/ );
 
+    # "ticket show 4" should DWIM and "ticket show --id=4"
+    $self->set_arg(id => pop @primary)
+        if $primary[-1] =~ /^\d+$/;
+
     my $sep = 0;
     my @sep_method = (
         'set_arg',

Added: Prophet/trunk/t/cli.t
==============================================================================
--- (empty file)
+++ Prophet/trunk/t/cli.t	Tue Jul 29 11:09:04 2008
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Prophet::Test tests => 2;
+
+as_alice {
+    like(run_command(qw(create --type Bug -- --status new --from alice)), qr/Created Bug/, "Created a record as alice");
+    like(run_command(qw(show 1 --type Bug --batch)), qr/id: 1/, "'show 1' dwims");
+};
+



More information about the Bps-public-commit mailing list