mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
make --hook-type and stages match
This commit is contained in:
parent
02e9680a46
commit
e3e17a1617
10 changed files with 147 additions and 42 deletions
|
|
@ -7,6 +7,7 @@ import sys
|
|||
from typing import Sequence
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import clientlib
|
||||
from pre_commit import git
|
||||
from pre_commit.color import add_color_option
|
||||
from pre_commit.commands.autoupdate import autoupdate
|
||||
|
|
@ -52,7 +53,7 @@ def _add_config_option(parser: argparse.ArgumentParser) -> None:
|
|||
def _add_hook_type_option(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
'-t', '--hook-type',
|
||||
choices=C.HOOK_TYPES, action='append', dest='hook_types',
|
||||
choices=clientlib.HOOK_TYPES, action='append', dest='hook_types',
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -73,7 +74,10 @@ def _add_run_options(parser: argparse.ArgumentParser) -> None:
|
|||
help='When hooks fail, run `git diff` directly afterward.',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--hook-stage', choices=C.STAGES, default='commit',
|
||||
'--hook-stage',
|
||||
choices=clientlib.STAGES,
|
||||
type=clientlib.transform_stage,
|
||||
default='pre-commit',
|
||||
help='The stage during which the hook is fired. One of %(choices)s',
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue