def _psql_cmd(*args, **kwargs):
 (user, host, port, maintenance_db, password) = _connection_defaults(kwargs.get('user'), kwargs.get('host'), kwargs.get('port'), kwargs.get('maintenance_db'), kwargs.get('password'))
 _PSQL_BIN = _find_pg_binary('psql')
 cmd = [_PSQL_BIN, '--no-align', '--no-readline', '--no-psqlrc', '--no-password']
 if user:
  cmd += ['--username', user]
 if host:
  cmd += ['--host', host]
 if port:
  cmd += ['--port', str(port)]
 if (not maintenance_db):
  maintenance_db = 'postgres'
 cmd.extend(['--dbname', maintenance_db])
 cmd.extend(args)
 return cmd

def _psql_cmd ( * args , ** kwargs ) : ( user , host , port , maintenance_db , password ) = _connection_defaults ( kwargs . get ( 'user' ) , kwargs . get ( 'host' ) , kwargs . get ( 'port' ) , kwargs . get ( 'maintenance_db' ) , kwargs . get ( 'password' ) ) _PSQL_BIN = _find_pg_binary ( 'psql' ) cmd = [ _PSQL_BIN , '--no-align' , '--no-readline' , '--no-psqlrc' , '--no-password' ] if user : cmd += [ '--username' , user ] if host : cmd += [ '--host' , host ] if port : cmd += [ '--port' , str ( port ) ] if ( not maintenance_db ) : maintenance_db = 'postgres' cmd . extend ( [ '--dbname' , maintenance_db ] ) cmd . extend ( args ) return cmd
return string with fully composed psql command .