summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2015-01-10 17:05:50 -0800
committerAmjith Ramanujam <amjith.r@gmail.com>2015-01-10 17:05:50 -0800
commitc9f651ba39562bc7fa471f75fb859c26400b5dfe (patch)
tree3d14a21d7d34706669b297c399295371761ba454
parent39a039fb8eb731495ef5774199502154a08e75ad (diff)
parent8d502bf0cc920e473a16286ab0f150b83200ab35 (diff)
Merge pull request #105 from fpietka/master
allows pgcli to connect to specified user's database
-rwxr-xr-xpgcli/main.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pgcli/main.py b/pgcli/main.py
index 9a89cf4f..dd2506a7 100755
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -99,8 +99,11 @@ class PGCli(object):
# Connect to the database.
if not database:
- # default to current OS username just like psql
- database = user = getuser()
+ if user:
+ database = user
+ else:
+ # default to current OS username just like psql
+ database = user = getuser()
# Prompt for a password immediately if requested via the -W flag. This
# avoids wasting time trying to connect to the database and catching a