summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBojan Delić <bojan@delic.rs>2017-12-20 20:48:26 +0100
committerBojan Delić <bojan@delic.rs>2017-12-20 23:58:53 +0100
commit8bd7a7a94f4615836de3c431ef5e97da60c77801 (patch)
treef55825339548a442ad38f5fc251498c70d5221ff
parentb2e572bf8291c54ea0ced8a6e43444ed6ed2c744 (diff)
Include username to password prompt. #823
As described in ticket #823, this is useful for matching prompt for different usernames and auto populating passwords. iTerm2 has password manager that is capable of doing this, but other terminal managers might be able to do it as well.
-rw-r--r--pgcli/main.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pgcli/main.py b/pgcli/main.py
index 846b41cc..e69fb0e9 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -365,7 +365,7 @@ class PGCli(object):
# If we successfully parsed a password from a URI, there's no need to
# prompt for it, even with the -W flag
if self.force_passwd_prompt and not passwd:
- passwd = click.prompt('Password', hide_input=True,
+ passwd = click.prompt('Password for %s' % user, hide_input=True,
show_default=False, type=str)
# Prompt for a password after 1st attempt to connect without a password
@@ -383,8 +383,9 @@ class PGCli(object):
except (OperationalError, InterfaceError) as e:
if ('no password supplied' in utf8tounicode(e.args[0]) and
auto_passwd_prompt):
- passwd = click.prompt('Password', hide_input=True,
- show_default=False, type=str)
+ passwd = click.prompt('Password for %s' % user,
+ hide_input=True, show_default=False,
+ type=str)
pgexecute = PGExecute(database, user, passwd, host, port,
dsn, **kwargs)
else: