mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Provide an environment variable to override the pre-commit command.
This commit is contained in:
parent
282527ef16
commit
b282c18eb1
1 changed files with 4 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
# File generated by pre-commit: https://pre-commit.com
|
# File generated by pre-commit: https://pre-commit.com
|
||||||
# ID: 138fd403232d2ddd5efb44317e38bf03
|
# ID: 138fd403232d2ddd5efb44317e38bf03
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# we try our best, but the shebang of this script is difficult to determine:
|
# we try our best, but the shebang of this script is difficult to determine:
|
||||||
|
|
@ -25,7 +26,9 @@ ARGS.append('--')
|
||||||
ARGS.extend(sys.argv[1:])
|
ARGS.extend(sys.argv[1:])
|
||||||
|
|
||||||
DNE = '`pre-commit` not found. Did you forget to activate your virtualenv?'
|
DNE = '`pre-commit` not found. Did you forget to activate your virtualenv?'
|
||||||
if os.access(INSTALL_PYTHON, os.X_OK):
|
if "PRE_COMMIT_CMD" in os.environ:
|
||||||
|
CMD = shlex.split(os.environ.get("PRE_COMMIT_CMD"))
|
||||||
|
elif os.access(INSTALL_PYTHON, os.X_OK):
|
||||||
CMD = [INSTALL_PYTHON, '-mpre_commit']
|
CMD = [INSTALL_PYTHON, '-mpre_commit']
|
||||||
elif which('pre-commit'):
|
elif which('pre-commit'):
|
||||||
CMD = ['pre-commit']
|
CMD = ['pre-commit']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue