73
73
# bar depending on what we think of the terminal
74
74
return progress.ProgressBar()
76
def get_login(self, prompt='', **kwargs):
77
"""Prompt the user for a login (generally on a remote host).
79
:param prompt: The prompt to present the user
80
:param kwargs: Arguments which will be expanded into the prompt.
81
This lets front ends display different things if
83
:return: The user string, return None if the user
87
prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
89
login = self.stdin.readline()
90
login = login.rstrip('\n')
93
def get_password(self, prompt='', **kwargs):
94
"""Prompt the user for a password.
96
:param prompt: The prompt to present the user
97
:param kwargs: Arguments which will be expanded into the prompt.
98
This lets front ends display different things if
100
:return: The password string, return None if the user
101
canceled the request.
104
prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
105
# There's currently no way to say 'i decline to enter a password'
106
# as opposed to 'my password is empty' -- does it matter?
107
return getpass.getpass(prompt)
109
76
def nested_progress_bar(self):
110
77
"""Return a nested progress bar.