[Rt-commit] r5102 - in rt/branches/3.7-EXPERIMENTAL: . bin

ruz at bestpractical.com ruz at bestpractical.com
Tue Apr 25 09:27:50 EDT 2006


Author: ruz
Date: Tue Apr 25 09:27:48 2006
New Revision: 5102

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

Log:
 r2399 at cubic-pc (orig r5002):  kevinr | 2006-04-11 03:02:25 +0400
  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.7-EXPERIMENTAL/bin/rt.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/bin/rt.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/bin/rt.in	Tue Apr 25 09:27:48 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.7-EXPERIMENTAL/lib/t/regression/26command_line.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/t/regression/26command_line.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/regression/26command_line.t	Tue Apr 25 09:27:48 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