Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb8fb8c

Browse files
authored
Merge pull request #585 from pre-commit/uninstall_commit_msg
Allow commit-msg hooks to be uninstalled
2 parents 21b563d + 5491f8b commit cb8fb8c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

pre_commit/main.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ def _add_config_option(parser):
4545
)
4646

4747

48+
def _add_hook_type_option(parser):
49+
parser.add_argument(
50+
'-t', '--hook-type', choices=('pre-commit', 'pre-push', 'commit-msg'),
51+
default='pre-commit',
52+
)
53+
54+
4855
def main(argv=None):
4956
argv = argv if argv is not None else sys.argv[1:]
5057
argv = [five.to_text(arg) for arg in argv]
@@ -75,10 +82,7 @@ def main(argv=None):
7582
'in the config file.'
7683
),
7784
)
78-
install_parser.add_argument(
79-
'-t', '--hook-type', choices=('pre-commit', 'pre-push', 'commit-msg'),
80-
default='pre-commit',
81-
)
85+
_add_hook_type_option(install_parser)
8286
install_parser.add_argument(
8387
'--allow-missing-config', action='store_true', default=False,
8488
help=(
@@ -103,10 +107,7 @@ def main(argv=None):
103107
)
104108
_add_color_option(uninstall_parser)
105109
_add_config_option(uninstall_parser)
106-
uninstall_parser.add_argument(
107-
'-t', '--hook-type', choices=('pre-commit', 'pre-push'),
108-
default='pre-commit',
109-
)
110+
_add_hook_type_option(uninstall_parser)
110111

111112
clean_parser = subparsers.add_parser(
112113
'clean', help='Clean out pre-commit files.',

0 commit comments

Comments
 (0)