Gets confirmation from the user. Prints a confirmation message to stdout with the given text and waits for user confirmation. Args: text: the text to include in the confirmation. Returns: True if the user confirmed she wanted to continue or False if otherwise.
(text)
| 99 | # Misc |
| 100 | |
| 101 | def conf_dialog(text): |
| 102 | """Gets confirmation from the user. |
| 103 | |
| 104 | Prints a confirmation message to stdout with the given text and waits for |
| 105 | user confirmation. |
| 106 | |
| 107 | Args: |
| 108 | text: the text to include in the confirmation. |
| 109 | |
| 110 | Returns: |
| 111 | True if the user confirmed she wanted to continue or False if otherwise. |
| 112 | """ |
| 113 | msg('{0}. Do you wish to continue? (y/N)'.format(text)) |
| 114 | user_input = get_user_input() |
| 115 | return user_input and user_input[0].lower() == 'y' |
| 116 | |
| 117 | |
| 118 | def get_user_input(text='> '): |
nothing calls this directly
no test coverage detected