mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Add a manual stage for cli-only interaction
This commit is contained in:
parent
4088f55ee6
commit
bf5792eb10
5 changed files with 30 additions and 45 deletions
|
|
@ -35,10 +35,7 @@ MANIFEST_HOOK_DICT = cfgv.Map(
|
|||
cfgv.Required('id', cfgv.check_string),
|
||||
cfgv.Required('name', cfgv.check_string),
|
||||
cfgv.Required('entry', cfgv.check_string),
|
||||
cfgv.Required(
|
||||
'language',
|
||||
cfgv.check_and(cfgv.check_string, cfgv.check_one_of(all_languages)),
|
||||
),
|
||||
cfgv.Required('language', cfgv.check_one_of(all_languages)),
|
||||
|
||||
cfgv.Optional(
|
||||
'files', cfgv.check_and(cfgv.check_string, cfgv.check_regex), '',
|
||||
|
|
@ -59,7 +56,7 @@ MANIFEST_HOOK_DICT = cfgv.Map(
|
|||
cfgv.Optional('language_version', cfgv.check_string, 'default'),
|
||||
cfgv.Optional('log_file', cfgv.check_string, ''),
|
||||
cfgv.Optional('minimum_pre_commit_version', cfgv.check_string, '0'),
|
||||
cfgv.Optional('stages', cfgv.check_array(cfgv.check_string), []),
|
||||
cfgv.Optional('stages', cfgv.check_array(cfgv.check_one_of(C.STAGES)), []),
|
||||
cfgv.Optional('verbose', cfgv.check_bool, False),
|
||||
)
|
||||
MANIFEST_SCHEMA = cfgv.Array(MANIFEST_HOOK_DICT)
|
||||
|
|
|
|||
|
|
@ -20,3 +20,6 @@ LOCAL_REPO_VERSION = '1'
|
|||
|
||||
VERSION = pkg_resources.get_distribution('pre-commit').version
|
||||
VERSION_PARSED = pkg_resources.parse_version(VERSION)
|
||||
|
||||
# `manual` is not invoked by any installed git hook. See #719
|
||||
STAGES = ('commit', 'commit-msg', 'manual', 'push')
|
||||
|
|
|
|||
|
|
@ -70,9 +70,8 @@ def _add_run_options(parser):
|
|||
help='Filename to check when running during `commit-msg`',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--hook-stage', choices=('commit', 'push', 'commit-msg'),
|
||||
default='commit',
|
||||
help='The stage during which the hook is fired e.g. commit or push.',
|
||||
'--hook-stage', choices=C.STAGES, default='commit',
|
||||
help='The stage during which the hook is fired. One of %(choices)s',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--show-diff-on-failure', action='store_true',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue