[Rt-commit] r5002 - in rt/branches/3.5-TESTING: . lib/t/regression

kevinr at bestpractical.com kevinr at bestpractical.com
Mon Apr 10 19:02:26 EDT 2006


Author: kevinr
Date: Mon Apr 10 19:02:25 2006
New Revision: 5002

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/bin/rt.in
   rt/branches/3.5-TESTING/lib/t/regression/26command_line.t

Log:
 r12011 at sad-girl-in-snow:  kevinr | 2006-04-10 19:00:46 -0400
 * Made the command-line tool not spew the entire help text if you give it an
   unrecognized command
 * Made the command-line tool ignore a leading 'rt' in a command in shell mode
   (eg. 'rt create' does the same thing as just 'create')
 * Added a test for the latter


Modified: rt/branches/3.5-TESTING/bin/rt.in
==============================================================================
--- rt/branches/3.5-TESTING/bin/rt.in	(original)
+++ rt/branches/3.5-TESTING/bin/rt.in	Mon Apr 10 19:02:25 2006
@@ -133,10 +133,17 @@
 sub handler {
     my $action;
 
+    if ($ARGV[0] eq 'rt') {
+        shift @ARGV;  # ignore a leading 'rt'
+    }
     if (@ARGV && exists $actions{$ARGV[0]}) {
         $action = shift @ARGV;
+        $actions{$action}->($action);
+    }
+    else {
+        print STDERR "rt: Unknown command '@ARGV'.\n";
+        print STDERR "rt: For help, run 'rt help'.\n";
     }
-    $actions{$action || "help"}->($action || ());
 }
 
 handler();

Modified: rt/branches/3.5-TESTING/lib/t/regression/26command_line.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/26command_line.t	(original)
+++ rt/branches/3.5-TESTING/lib/t/regression/26command_line.t	Mon Apr 10 19:02:25 2006
@@ -3,7 +3,7 @@
 use strict;
 use Test::Expect;
 #use Test::More qw/no_plan/;
-use Test::More tests => 100;
+use Test::More tests => 102;
 
 use RT;
 RT::LoadConfig();
@@ -61,6 +61,10 @@
 expect_send(q{create -t ticket set subject='new ticket'}, "Creating a ticket as just a subject...");
 expect_like(qr/Ticket \d+ created/, "Created the ticket");
 
+# make sure we can request things as 'rt foo'
+expect_send(q{rt create -t ticket set subject='rt ticket'}, "Creating a ticket with 'rt create'...");
+expect_like(qr/Ticket \d+ created/, "Created the ticket");
+
 # add a comment to ticket
 TODO: {
     local $TODO = "Adding comments/correspondence is broken right now";


More information about the Rt-commit mailing list