Skip to content

Commit

Permalink
respect NO_COLOR env var in cmd, and refactoring in defineFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Jan 24, 2025
1 parent 2f47bb8 commit 36f8742
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pyglossary/ui/argparse_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@


def defineFlags(parser: argparse.ArgumentParser, config: dict[str, Any]) -> None:
defaultHasColor = config.get(
"color.enable.cmd.windows" if os.sep == "\\" else "color.enable.cmd.unix",
True,
)
osType = "windows" if os.sep == "\\" else "unix"
colorConf = f"color.enable.cmd.{osType}"
defaultHasColor = config.get(colorConf, True) and not os.getenv("NO_COLOR")
parser.add_argument(
"-v",
"--verbosity",
Expand Down

0 comments on commit 36f8742

Please sign in to comment.