Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion graphtage/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def main(argv=None) -> int:
help='do not print a newline after each key/value pair in a dictionary')
formatting.add_argument('--condensed', '-j', action='store_true', help='equivalent to `-jl -jd`')
formatting.add_argument('--html', action='store_true', help='output the diff in HTML')
formatting.add_argument('--no-unicode', action='store_true',
help='do not use Unicode combining marks in the output (only use colors)')
key_match_strategy = parser.add_mutually_exclusive_group()
key_match_strategy.add_argument("--dict-strategy", "-ds", choices=("auto", "match", "none"),
help="sets the strategy for matching dictionary key/value pairs: `auto` (the "
Expand Down Expand Up @@ -206,7 +208,8 @@ def printer_type(*pos_args, **kwargs):
options={
'join_lists': args.condensed or args.join_lists,
'join_dict_items': args.condensed or args.join_dict_items
}
},
enable_unicode=not args.no_unicode
)
printermodule.DEFAULT_PRINTER = printer

Expand Down
6 changes: 5 additions & 1 deletion graphtage/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ def __init__(
out_stream: Optional[Writer] = None,
ansi_color: Optional[bool] = None,
quiet: bool = False,
options: Optional[Dict[str, Any]] = None
options: Optional[Dict[str, Any]] = None,
enable_unicode: bool = True
):
"""Initializes a Printer.

Expand All @@ -461,6 +462,8 @@ def __init__(
quiet: If :const:`True`, progress and status messages will be suppressed.
options: An optional dict, the keys of which will be set as attributes of this class. This is used to
provide additional formatting options to functions that use this printer.
enable_unicode: Whether or not Unicode combining marks should be used in the output. If :const:`False`,
only ANSI colors will be used to highlight differences.

"""
if out_stream is None:
Expand All @@ -472,6 +475,7 @@ def __init__(
self._context_type: Type[ANSIContext] = ANSIContext
self.out_stream: CombiningMarkWriter = CombiningMarkWriter(self)
"""The stream wrapped by this printer."""
self.out_stream.enabled = enable_unicode
self.indents: int = 0
"""The number of indent steps."""
self.indent_str: str = ' ' * 4
Expand Down
Loading