[Rt-commit] r4739 - in rt/branches/3.5-TESTING: .

kevinr at bestpractical.com kevinr at bestpractical.com
Mon Mar 13 16:51:18 EST 2006


Author: kevinr
Date: Mon Mar 13 16:51:18 2006
New Revision: 4739

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/bin/rt.in

Log:
 r11363 at SAD-GIRL-IN-SNOW:  kevinr | 2006-03-06 23:33:15 -0500
 * Added basic Term::ReadLine support to the CLI


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 Mar 13 16:51:18 2006
@@ -57,6 +57,7 @@
 use LWP;
 use Text::ParseWords;
 use HTTP::Request::Common;
+use Term::ReadLine;
 
 # We derive configuration information from hardwired defaults, dotfiles,
 # and the RT* environment variables (in increasing order of precedence).
@@ -81,6 +82,10 @@
 my $session = new Session("$HOME/.rt_sessions");
 my $REST = "$config{server}/REST/1.0";
 
+my $term = new Term::ReadLine 'RT CLI';
+my $prompt = 'rt> ';
+my $TERM_OUT = $term->OUT || \*STDOUT;
+
 sub whine;
 sub DEBUG { warn @_ if $config{debug} >= shift }
 
@@ -144,16 +149,12 @@
 
 sub shell {
     $|=1;
-    print "rt> ";
-    while (<>) {
-        chomp;
+    while ( defined ($_ = $term->readline($prompt)) ) {
         next if /^#/ || /^\s*$/;
 
         @ARGV = shellwords($_);
         handler();
-        print "rt> ";
     }
-    print "\n";
 }
 
 sub version {


More information about the Rt-commit mailing list