1
0
Fork 0

Merging upstream version 2.7.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 21:21:56 +01:00
parent 5aec43d541
commit 57d38a2ac5
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
24 changed files with 323 additions and 99 deletions

View file

@ -1,3 +1,4 @@
import argparse
import os
import sys
@ -95,3 +96,12 @@ def use_color(setting: str) -> bool:
os.getenv('TERM') != 'dumb'
)
)
def add_color_option(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
'--color', default=os.environ.get('PRE_COMMIT_COLOR', 'auto'),
type=use_color,
metavar='{' + ','.join(COLOR_CHOICES) + '}',
help='Whether to use color in output. Defaults to `%(default)s`.',
)