Restore default text input in munkiimport under 10.6

This commit is contained in:
Greg Neagle
2016-10-12 15:00:01 -07:00
parent 0269b1a89c
commit 78d58b58a5
+14 -2
View File
@@ -148,9 +148,21 @@ else:
def raw_input_with_default(prompt, default_text):
'''A nasty, nasty hack to get around Python readline limitations under
OS X. Gives us editable default text for munkiimport choices'''
'''Get input from user with a prompt and a suggested default value'''
# 10.6's libedit doesn't have the rl_set_prompt function, so we fall back
# to the previous behavior
if munkicommon.getOsVersion() == '10.6':
if default_text:
prompt = '%s [%s]: ' % (prompt.rstrip(': '), default_text)
return (unicode(raw_input(prompt), encoding=sys.stdin.encoding) or
unicode(default_text))
else:
# no default value, just call raw_input
return unicode(raw_input(prompt), encoding=sys.stdin.encoding)
# A nasty, nasty hack to get around Python readline limitations under
# OS X. Gives us editable default text for munkiimport choices'''
def insert_default_text(prompt, text):
'''Helper function'''
time.sleep(0.01)