CVS: tmda-cgi configure,1.12,1.13

Gre7g Luterman <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv22061

Modified Files:
	configure 
Log Message:
Improved the tab completion stuff.


Index: configure
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/configure,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- configure	17 Jun 2003 02:19:55 -0000	1.12
+++ configure	17 Jun 2003 03:46:51 -0000	1.13
@@ -149,12 +149,23 @@
 import string
 import sys
 
+# Tab completion support (if library is present)
+def SetDefault():
+  readline.insert_text(DefaultInput)
+def PlainInput(Default):
+  return raw_input("(%s): " % Default)
+def TabCompInput(Default):
+  global DefaultInput
+  DefaultInput = Default
+  return raw_input("> ")
 try:
   import readline
   readline.set_completer_delims(" |=")
   readline.parse_and_bind("tab: complete")
+  readline.set_startup_hook(SetDefault)
+  Input = TabCompInput
 except ImportError:
-  pass
+  Input = PlainInput
 
 def Ask(Question, Str, ValProg = None, TestStr = None):
   "Ask for a member from the keyboard."
@@ -163,7 +174,7 @@
 
   while 1:
     print "\n" + Question
-    Temp = raw_input("(%s): " % OptD[Str]).strip()
+    Temp = Input(OptD[Str]).strip()
     if Temp:
       Limit = re.search("\[(.+,.+)\]", Question)
       if Limit and not (Temp in Limit.group(1).split(", ")): continue
@@ -173,7 +184,7 @@
       if not ValProg(Filename):
         print "Warning!  Cannot locate: %s" % Filename
         print "Use this value anyhow? [Yes, No]"
-        Temp = raw_input("(No):").strip().lower()
+        Temp = Input("No").strip().lower()
         if not Temp or (Temp[0] != "y"): continue
     break
 

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.