[rt-commit] [svn] r520 - rt/branches/rt-3.1/bin
jesse at fsck.com
jesse at fsck.com
Tue Mar 9 17:31:40 EST 2004
Author: jesse
Date: Tue Mar 9 17:31:40 2004
New Revision: 520
Modified:
rt/branches/rt-3.1/bin/rt.in
Log:
#5091: Support for a minimal RT shell
Modified: rt/branches/rt-3.1/bin/rt.in
==============================================================================
--- rt/branches/rt-3.1/bin/rt.in (original)
+++ rt/branches/rt-3.1/bin/rt.in Tue Mar 9 17:31:40 2004
@@ -30,6 +30,7 @@
use Cwd;
use LWP;
+use Text::ParseWords;
use HTTP::Request::Common;
# We derive configuration information from hardwired defaults, dotfiles,
@@ -75,6 +76,7 @@
my %handlers = (
# handler => [ ...aliases... ],
version => ["version", "ver"],
+ shell => ["shell"],
logout => ["logout"],
help => ["help", "man"],
show => ["show", "cat"],
@@ -95,7 +97,7 @@
# Once we find and call an appropriate handler, we're done.
-sub handle {
+sub handler {
my $action;
if (@ARGV && exists $actions{$ARGV[0]}) {
@@ -104,13 +106,27 @@
$actions{$action || "help"}->($action || ());
}
-handle(@ARGV);
+handler();
exit;
# Handler functions.
# ------------------
#
# The following subs are handlers for each entry in %actions.
+
+sub shell {
+ $|=1;
+ print "rt> ";
+ while (<>) {
+ chomp;
+ next if /^#/ || /^\s*$/;
+
+ @ARGV = shellwords($_);
+ handler();
+ print "rt> ";
+ }
+ print "\n";
+}
sub version {
print "rt $VERSION\n";
More information about the Rt-commit
mailing list