Add a hook option that allows stdout to be printed when exit code is 0 (#695)

This commit is contained in:
Bastien Gérard
2018-01-31 23:05:35 +01:00
parent 7f0b427b74
commit b319d6f80c
4 changed files with 23 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ MANIFEST_HOOK_DICT = schema.Map(
schema.Optional('log_file', schema.check_string, ''),
schema.Optional('minimum_pre_commit_version', schema.check_string, '0'),
schema.Optional('stages', schema.check_array(schema.check_string), []),
schema.Optional('verbose', schema.check_bool, False),
)
MANIFEST_SCHEMA = schema.Array(MANIFEST_HOOK_DICT)

View File

@@ -130,7 +130,10 @@ def _run_single_hook(filenames, hook, repo, args, skips, cols):
output.write_line(color.format_color(pass_fail, print_color, args.color))
if (stdout or stderr or file_modifications) and (retcode or args.verbose):
if (
(stdout or stderr or file_modifications) and
(retcode or args.verbose or hook['verbose'])
):
output.write_line('hookid: {}\n'.format(hook['id']))
# Print a message if failing due to file modifications