show color in hook outputs when attached to a tty

This commit is contained in:
Anthony Sottile 2019-10-12 15:57:40 -07:00
parent c8620f35e1
commit 7c3404ef1f
27 changed files with 200 additions and 76 deletions

View file

@ -38,16 +38,17 @@ from pre_commit.languages import system
# version - A version specified in the hook configuration or 'default'.
# """
#
# def run_hook(hook, file_args):
# def run_hook(hook, file_args, color):
# """Runs a hook and returns the returncode and output of running that
# hook.
#
# Args:
# hook - `Hook`
# file_args - The files to be run
# color - whether the hook should be given a pty (when supported)
#
# Returns:
# (returncode, stdout, stderr)
# (returncode, output)
# """
languages = {