Skip to content

Commit df3ac87

Browse files
committed
Add an output pager.
Fixes #50. Requires pallets/click#1572.
1 parent 09287b2 commit df3ac87

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sno/diff_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def diff_output_text(*, output_path, **kwargs):
6060

6161
def _out(dataset, diff):
6262
with resolve_output_path(output_path) as fp:
63-
pecho = {'file': fp, 'color': getattr(fp, 'color', fp.isatty())}
63+
pecho = {'file': fp, 'color': True}
6464
path = dataset.path
6565
pk_field = dataset.primary_key
6666
prefix = f"{path}:"

sno/output_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def dump_json_output(output, output_path, json_style="pretty"):
2222
"""
2323

2424
with resolve_output_path(output_path) as fp:
25-
if json_style == 'pretty' and getattr(fp, 'color', fp.isatty()):
25+
if json_style == 'pretty':
2626
# Add syntax highlighting
2727
from pygments import highlight
2828
from pygments.lexers import JsonLexer
@@ -62,7 +62,7 @@ def resolve_output_path(output_path, allow_pager=True):
6262
)
6363

6464
with _push_environment('PAGER', pager_cmd):
65-
with click.get_pager_file(color=True) as pager:
65+
with click.get_pager_file() as pager:
6666
yield pager
6767
else:
6868
yield sys.stdout

sno/show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def patch_output_text(*, target, output_path, **kwargs):
9393
"""
9494
commit = target.head_commit
9595
with resolve_output_path(output_path) as fp:
96-
pecho = {'file': fp, 'color': getattr(fp, 'color', fp.isatty())}
96+
pecho = {'file': fp, 'color': True}
9797
with diff.diff_output_text(output_path=fp, **kwargs) as diff_writer:
9898
author = commit.author
9999
author_time_utc = datetime.fromtimestamp(author.time, timezone.utc)

0 commit comments

Comments
 (0)