mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Allow init-templatedir to be called outside of git
This commit is contained in:
parent
7f1e9c1907
commit
da80cc6479
1 changed files with 4 additions and 1 deletions
|
|
@ -36,6 +36,9 @@ logger = logging.getLogger('pre_commit')
|
||||||
os.environ.pop('__PYVENV_LAUNCHER__', None)
|
os.environ.pop('__PYVENV_LAUNCHER__', None)
|
||||||
|
|
||||||
|
|
||||||
|
COMMANDS_NO_GIT = {'clean', 'gc', 'init-templatedir', 'sample-config'}
|
||||||
|
|
||||||
|
|
||||||
def _add_color_option(parser):
|
def _add_color_option(parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--color', default=os.environ.get('PRE_COMMIT_COLOR', 'auto'),
|
'--color', default=os.environ.get('PRE_COMMIT_COLOR', 'auto'),
|
||||||
|
|
@ -273,7 +276,7 @@ def main(argv=None):
|
||||||
parser.parse_args(['--help'])
|
parser.parse_args(['--help'])
|
||||||
|
|
||||||
with error_handler(), logging_handler(args.color):
|
with error_handler(), logging_handler(args.color):
|
||||||
if args.command not in {'clean', 'gc', 'sample-config'}:
|
if args.command not in COMMANDS_NO_GIT:
|
||||||
_adjust_args_and_chdir(args)
|
_adjust_args_and_chdir(args)
|
||||||
|
|
||||||
git.check_for_cygwin_mismatch()
|
git.check_for_cygwin_mismatch()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue