Revision 7147e1ca kamaki/cli/utils.py
b/kamaki/cli/utils.py | ||
---|---|---|
323 | 323 |
terms.append(ipart[2:-2]) |
324 | 324 |
terms += _sub_split(trivial_parts[-1]) |
325 | 325 |
return terms |
326 |
|
|
327 |
|
|
328 |
def ask_user(msg, true_responses=('Y', 'y')): |
|
329 |
"""Print msg and read user response |
|
330 |
|
|
331 |
:param true_responses: (tuple of chars) |
|
332 |
|
|
333 |
:returns: (bool) True if reponse in true responses, False otherwise |
|
334 |
""" |
|
335 |
stdout.write('%s (%s for yes):' % (msg, true_responses)) |
|
336 |
stdout.flush() |
|
337 |
user_response = stdin.read(1) |
|
338 |
return user_response[0] in true_responses |
Also available in: Unified diff