summaryrefslogtreecommitdiff
path: root/misc/hooks/pre-commit-black
diff options
context:
space:
mode:
Diffstat (limited to 'misc/hooks/pre-commit-black')
-rwxr-xr-xmisc/hooks/pre-commit-black8
1 files changed, 6 insertions, 2 deletions
diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black
index 3dd0a13330..2dcc2e8cf1 100755
--- a/misc/hooks/pre-commit-black
+++ b/misc/hooks/pre-commit-black
@@ -18,8 +18,12 @@ FILE_EXTS="py"
# Use pygmentize instead of cat to parse diff with highlighting.
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
-# READER="pygmentize -l diff"
-READER=cat
+PYGMENTIZE=`which pygmentize`
+if [ ! -z "$PYGMENTIZE" ]; then
+ READER="pygmentize -l diff"
+else
+ READER=cat
+fi
##################################################################
# There should be no need to change anything below this line.