mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
show color in hook outputs when attached to a tty
This commit is contained in:
parent
c8620f35e1
commit
7c3404ef1f
27 changed files with 200 additions and 76 deletions
|
|
@ -13,10 +13,10 @@ healthy = helpers.basic_healthy
|
|||
install_environment = helpers.no_install
|
||||
|
||||
|
||||
def run_hook(hook, file_args):
|
||||
def run_hook(hook, file_args, color):
|
||||
# For PCRE the entry is the regular expression to match
|
||||
cmd = (GREP, '-H', '-n', '-P') + tuple(hook.args) + (hook.entry,)
|
||||
|
||||
# Grep usually returns 0 for matches, and nonzero for non-matches so we
|
||||
# negate it here.
|
||||
return xargs(cmd, file_args, negate=True)
|
||||
return xargs(cmd, file_args, negate=True, color=color)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue