~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-07 11:54:04 UTC
  • mfrom: (4222.2.11 ui-username)
  • mto: This revision was merged to the branch mainline in revision 4284.
  • Revision ID: jelmer@samba.org-20090407115404-hyi0ky5adtshx5q9
merge new ui-username work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
        return self.get_non_echoed_password()
199
199
 
200
200
    def get_username(self, prompt, **kwargs):
201
 
        """Prompt the user for a password.
 
201
        """Prompt the user for a username.
202
202
 
203
203
        :param prompt: The prompt to present the user
204
204
        :param kwargs: Arguments which will be expanded into the prompt.
209
209
        """
210
210
        prompt += ': '
211
211
        self.prompt(prompt, **kwargs)
212
 
        return self.stdin.readline().rstrip("\n")
 
212
        username = self.stdin.readline()
 
213
        if not username:
 
214
            username = None
 
215
        elif username[-1] == '\n':
 
216
            username = username[:-1]
 
217
        return username
213
218
 
214
219
    def prompt(self, prompt, **kwargs):
215
220
        """Emit prompt on the CLI."""