mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 08:34:41 +04:00
warn on old list-style configuration
This commit is contained in:
parent
c0f750d9b3
commit
68510596d3
4 changed files with 59 additions and 40 deletions
|
|
@ -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`.',
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue