better display to prompt user passwords

This commit is contained in:
Romain Bignon 2014-02-19 18:06:04 +01:00
commit 8955815805

View file

@ -395,6 +395,8 @@ class ConsoleApplication(BaseApplication):
question = u'[%s] %s' % (v.id, question) question = u'[%s] %s' % (v.id, question)
if isinstance(v, ValueBackendPassword): if isinstance(v, ValueBackendPassword):
print question.encode(sys.stdout.encoding or locale.getpreferredencoding()) + ':'
question = v.label
choices = OrderedDict() choices = OrderedDict()
choices['c'] = 'Run an external tool during backend load' choices['c'] = 'Run an external tool during backend load'
if not v.noprompt: if not v.noprompt:
@ -408,7 +410,7 @@ class ConsoleApplication(BaseApplication):
else: else:
d = 's' d = 's'
r = self.ask('%s: How do you want to store it?' % question, choices=choices, tiny=True, default=d) r = self.ask('*** How do you want to store it?', choices=choices, tiny=True, default=d)
if r == 'p': if r == 'p':
return '' return ''
if r == 'c': if r == 'c':
@ -441,10 +443,10 @@ class ConsoleApplication(BaseApplication):
question = u'%s (%s)' % (question, '/'.join((s.upper() if s == v.default else s) question = u'%s (%s)' % (question, '/'.join((s.upper() if s == v.default else s)
for s in (v.choices.iterkeys()))) for s in (v.choices.iterkeys())))
for key, value in v.choices.iteritems(): for key, value in v.choices.iteritems():
print '%s%s%s: %s' % (self.BOLD, key, self.NC, value) print ' %s%s%s: %s' % (self.BOLD, key, self.NC, value)
else: else:
for n, (key, value) in enumerate(v.choices.iteritems()): for n, (key, value) in enumerate(v.choices.iteritems()):
print '%s%2d)%s %s' % (self.BOLD, n + 1, self.NC, value) print ' %s%2d)%s %s' % (self.BOLD, n + 1, self.NC, value)
aliases[str(n + 1)] = key aliases[str(n + 1)] = key
question = u'%s (choose in list)' % question question = u'%s (choose in list)' % question
if v.masked: if v.masked: