diff options
-rw-r--r-- | lib/dbshell/postgres_client.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/dbshell/postgres_client.rb b/lib/dbshell/postgres_client.rb index a22ccf7..b77e681 100644 --- a/lib/dbshell/postgres_client.rb +++ b/lib/dbshell/postgres_client.rb @@ -1,4 +1,18 @@ class DBShell::PostgresClient + EXECUTABLE_NAME = 'psql' + def self.build_command(db_info) + args = [EXECUTABLE_NAME] + + host = db_info['host'] + port = db_info['port'] + db_name = db_info['database'] + user = db_info['username'] + password = db_info['password'] + + args.push('-U', user) if user + args.push('-h', host) if host + args.push('-p', port) if port + args.push(db_name) end end |