Skip to content

Commit 85d0e02

Browse files
committed
Do not align columns for markup tables.
1 parent 694919e commit 85d0e02

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

mycli/output_formatter/tabulate_adapter.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33

44
tabulate.PRESERVE_WHITESPACE = True
55

6-
supported_formats = ('plain', 'simple', 'grid', 'fancy_grid', 'pipe', 'orgtbl',
7-
'jira', 'psql', 'rst', 'mediawiki', 'moinmoin', 'html',
8-
'latex', 'latex_booktabs', 'textile')
6+
supported_markup_formats = ('mediawiki', 'html', 'latex', 'latex_booktabs',
7+
'textile', 'moinmoin', 'jira')
8+
supported_table_formats = ('plain', 'simple', 'grid', 'fancy_grid', 'pipe',
9+
'orgtbl', 'psql', 'rst')
10+
supported_formats = supported_markup_formats + supported_table_formats
911

1012
preprocessors = (bytes_to_string, align_decimals, quote_whitespaces)
1113

1214

1315
def tabulate_adapter(data, headers, table_format=None, missing_value='', **_):
1416
"""Wrap tabulate inside a standard function for OutputFormatter."""
15-
return tabulate.tabulate(data, headers, tablefmt=table_format,
16-
missingval=missing_value, disable_numparse=True)
17+
kwargs = {'tablefmt': table_format, 'missingval': missing_value,
18+
'disable_numparse': True}
19+
if table_format in supported_markup_formats:
20+
kwargs.update(numalign=None, stralign=None)
21+
22+
return tabulate.tabulate(data, headers, **kwargs)

0 commit comments

Comments
 (0)