Skip to content

Commit

Permalink
Disable indent guides when NO_COLOR is set
Browse files Browse the repository at this point in the history
  • Loading branch information
AndydeCleyre committed Sep 30, 2024
1 parent d97dc91 commit 6151ec5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nt2/dumpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pathlib import Path

from plumbum import LocalPath
from os import environ
from textwrap import indent
from typing import BinaryIO, Sequence, TextIO, cast

Expand Down Expand Up @@ -53,7 +54,13 @@ def _syntax_print(content: str, syntax: str, console: RichConsole = RICH):
console: An initialized Rich Console object used to print with.
"""
console.print(
RichSyntax(content, syntax, theme='ansi_dark', word_wrap=True, indent_guides=True)
RichSyntax(
content,
syntax,
theme='ansi_dark',
word_wrap=True,
indent_guides=not environ.get('NO_COLOR'),
)
)


Expand Down

0 comments on commit 6151ec5

Please sign in to comment.