mirror of
https://github.com/munki/munki.git
synced 2026-05-03 19:10:21 -05:00
Restore default text input in munkiimport under 10.6
This commit is contained in:
+14
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user