Skip to content

Commit

Permalink
Fix the double printing of output.
Browse files Browse the repository at this point in the history
  • Loading branch information
amjith committed Jan 9, 2015
1 parent 01847b5 commit 9a62921
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pgcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ def cli(database, user, host, port, prompt_passwd, never_prompt):
for rows, headers, status in res:
_logger.debug("headers: %r", headers)
_logger.debug("rows: %r", rows)
if rows:
if is_expanded_output():
output.append(expanded_table(rows, headers))
else:
output.append(tabulate(rows, headers, tablefmt='psql'))
if status: # Only print the status if it's not None.
output.append(status)
_logger.debug("status: %r", status)
output.extend(format_output(rows, headers, status))
click.echo_via_pager('\n'.join(output))
Expand All @@ -181,7 +174,10 @@ def cli(database, user, host, port, prompt_passwd, never_prompt):
def format_output(rows, headers, status):
output = []
if rows:
output.append(tabulate(rows, headers, tablefmt='psql'))
if is_expanded_output():
output.append(expanded_table(rows, headers))
else:
output.append(tabulate(rows, headers, tablefmt='psql'))
if status: # Only print the status if it's not None.
output.append(status)
return output
Expand Down

0 comments on commit 9a62921

Please sign in to comment.