Author: gnichols
Date: 2012-03-09 12:28:59 +0000 (Fri, 09 Mar 2012)
New Revision: 1218
Modified:
trunk/v7/commandLineUI.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Modified: trunk/v7/commandLineUI.py
===================================================================
--- trunk/v7/commandLineUI.py 2012-03-09 12:28:45 UTC (rev 1217)
+++ trunk/v7/commandLineUI.py 2012-03-09 12:28:59 UTC (rev 1218)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
#
import string, os, sys, copy, re
-import readline
+import readline, getpass
from tags import Constants
@@ -42,9 +42,13 @@
sys.stdout.write("response: %s" % response)
return response.strip()
- def promptInteger(self, question):
+ def promptInteger(self, question, answers=None):
while True:
sys.stdout.write(question)
+ if answers:
+ sys.stdout.write(" (")
+ sys.stdout.write("|".join(answers))
+ sys.stdout.write(") ")
sys.stdout.flush()
response = sys.stdin.readline()
try:
@@ -74,14 +78,21 @@
return self.promptConfirm(question=("%s - continue? " % message))
- def promptEdit(self, label, value):
+ def promptEdit(self, label, value, answers=None):
if not value:
value = ""
+ if answers:
+ label += " ("
+ label += "|".join(answers)
+ label += ") "
readline.set_startup_hook(lambda: readline.insert_text(value))
try:
return raw_input(label)
finally:
readline.set_startup_hook()
+
+ def promptPassword(self, message):
+ return getpass.getpass(message)