summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDick Marinus <dick@mrns.nl>2017-07-05 20:49:27 +0200
committerGitHub <noreply@github.com>2017-07-05 20:49:27 +0200
commit4c6a7012f89ebcc3b6862caea4ed08b4ad117a97 (patch)
tree1671217c7f660f2a69895e4769b59d62027ee42b
parent54fd351c50b7a34661f6fae170554d8d4b14621b (diff)
parent24bee65b814cb0010b78a944328e14641695ced8 (diff)
Merge pull request #466 from dbcli/feature/align_decimals_numparse
Use appropriate CLI Helpers formatting.
-rwxr-xr-xmycli/main.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/mycli/main.py b/mycli/main.py
index 3b7c48b..52dc93e 100755
--- a/mycli/main.py
+++ b/mycli/main.py
@@ -13,6 +13,7 @@ from random import choice
from io import open
from cli_helpers.tabular_output import TabularOutputFormatter
+from cli_helpers.tabular_output import preprocessors
import click
import sqlparse
from prompt_toolkit import CommandLineInterface, Application, AbortAction
@@ -786,18 +787,25 @@ class MyCli(object):
expanded = expanded or self.formatter.format_name == 'vertical'
output = []
+ output_kwargs = {
+ 'disable_numparse': True,
+ 'preserve_whitespace': True,
+ 'preprocessors': (preprocessors.align_decimals, )
+ }
+
if title: # Only print the title if it's not None.
output.append(title)
if cur:
rows = list(cur)
formatted = self.formatter.format_output(
- rows, headers, format_name='vertical' if expanded else None)
+ rows, headers, format_name='vertical' if expanded else None,
+ **output_kwargs)
if (not expanded and max_width and rows and
content_exceeds_width(rows[0], max_width) and headers):
formatted = self.formatter.format_output(
- rows, headers, format_name='vertical')
+ rows, headers, format_name='vertical', **output_kwargs)
output.append(formatted)