61
64
def prompt(self, prompt):
62
65
"""Emit prompt on the CLI."""
63
self.stdout.write(prompt)
66
self.stdout.write(prompt + "? [y/n]:")
68
@deprecated_method(zero_eight)
69
def progress_bar(self):
70
"""See UIFactory.nested_progress_bar()."""
71
# this in turn is abstract, and creates either a tty or dots
72
# bar depending on what we think of the terminal
73
return progress.ProgressBar()
75
def get_password(self, prompt='', **kwargs):
76
"""Prompt the user for a password.
78
:param prompt: The prompt to present the user
79
:param kwargs: Arguments which will be expanded into the prompt.
80
This lets front ends display different things if
82
:return: The password string, return None if the user
85
prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
87
# There's currently no way to say 'i decline to enter a password'
88
# as opposed to 'my password is empty' -- does it matter?
89
return getpass.getpass(prompt)
65
91
def nested_progress_bar(self):
66
92
"""Return a nested progress bar.