Mercurial > hg > truffle
diff mx/commands.py @ 11511:3110bea9a6b0
mx: add helper method for yes/no question
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 02 Sep 2013 11:40:24 +0200 |
parents | 94779c895aad |
children | 38acec26d535 |
line wrap: on
line diff
--- a/mx/commands.py Mon Sep 02 20:44:49 2013 +0200 +++ b/mx/commands.py Mon Sep 02 11:40:24 2013 +0200 @@ -95,8 +95,7 @@ items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None] descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None] vm = mx.select_items(items, descriptions, allowMultiple=False) - answer = raw_input('Persist this choice by adding "DEFAULT_VM=' + vm + '" to ' + envPath + '? [Yn]: ') - if not answer.lower().startswith('n'): + if mx.ask_yes_no('Persist this choice by adding "DEFAULT_VM=' + vm + '" to ' + envPath, 'y'): with open(envPath, 'a') as fp: print >> fp, 'DEFAULT_VM=' + vm _vm = vm @@ -281,8 +280,7 @@ def _handle_missing_VM(bld, vm): mx.log('The ' + bld + ' ' + vm + ' VM has not been created') if sys.stdout.isatty(): - answer = raw_input('Build it now? [Yn]: ') - if not answer.lower().startswith('n'): + if mx.ask_yes_no('Build it now', 'y'): with VM(vm, bld): build([]) return