From a8967ac34eb655cbe4822b579e6a0b834dc026f3 Mon Sep 17 00:00:00 2001 From: timriker Date: Fri, 22 Nov 2002 07:47:30 +0000 Subject: [PATCH] enhance cli with history, editing and doExit. install libterm-readline-gnu-perl or get no readline enhancements git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@687 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/interface.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/blootbot/src/interface.pl b/blootbot/src/interface.pl index c94e926..c786b83 100644 --- a/blootbot/src/interface.pl +++ b/blootbot/src/interface.pl @@ -26,14 +26,19 @@ sub cliloop { $addressed = 1; $msgType = 'public'; - print ">>> "; - while () { + # install libterm-readline-gnu-perl to get history support + use Term::ReadLine; + $term = new Term::ReadLine 'blootbot'; + $prompt = "$who> "; + #$OUT = $term->OUT || STDOUT; + while ( defined ($_ = $term->readline($prompt)) ) { $orig{message} = $_; $message = $_; chomp $message; + last if ($message =~ m/^quit$/); $_ = &process() if $message; - print ">>> "; } + &doExit(); } 1; -- 2.39.5