From 294f49275d8ca8ef86fd54d08e3d3105c767f98f Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sat, 9 May 2020 11:51:15 +0100 Subject: [PATCH] Expose verbosity to called hooks Allows hooks to check if pre-commit was called with verbose mode in order to change their behavior. Fixes: 1199 --- pre_commit/commands/run.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index c2dab6f7..8f3fdd53 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -347,6 +347,9 @@ def run( if args.checkout_type: environ['PRE_COMMIT_CHECKOUT_TYPE'] = args.checkout_type + if args.verbose: + environ['PRE_COMMIT_VERBOSE'] = '1' + with contextlib.ExitStack() as exit_stack: if stash: exit_stack.enter_context(staged_files_only(store.directory))