mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-05-17 22:20:53 -05:00
--hook-type is required for hook-impl
This commit is contained in:
+1
-1
@@ -357,7 +357,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
hook_impl_parser = subparsers.add_parser('hook-impl')
|
||||
add_color_option(hook_impl_parser)
|
||||
_add_config_option(hook_impl_parser)
|
||||
hook_impl_parser.add_argument('--hook-type')
|
||||
hook_impl_parser.add_argument('--hook-type', required=True)
|
||||
hook_impl_parser.add_argument('--hook-dir')
|
||||
hook_impl_parser.add_argument(
|
||||
'--skip-on-missing-config', action='store_true',
|
||||
|
||||
+7
-1
@@ -90,7 +90,7 @@ def test_adjust_args_try_repo_repo_relative(in_git_dir):
|
||||
|
||||
|
||||
FNS = (
|
||||
'autoupdate', 'clean', 'gc', 'hook_impl', 'install', 'install_hooks',
|
||||
'autoupdate', 'clean', 'gc', 'install', 'install_hooks',
|
||||
'migrate_config', 'run', 'sample_config', 'uninstall',
|
||||
'validate_config', 'validate_manifest',
|
||||
)
|
||||
@@ -169,6 +169,12 @@ def test_hazmat(mock_store_dir):
|
||||
assert arg.cmd == ['cmd', '--', 'f1', 'f2']
|
||||
|
||||
|
||||
def test_hook_impl(mock_store_dir):
|
||||
with mock.patch.object(main, 'hook_impl') as mck:
|
||||
main.main(('hook-impl', '--hook-type', 'pre-commit'))
|
||||
assert mck.call_count == 1
|
||||
|
||||
|
||||
def test_try_repo(mock_store_dir):
|
||||
with mock.patch.object(main, 'try_repo') as patch:
|
||||
main.main(('try-repo', '.'))
|
||||
|
||||
Reference in New Issue
Block a user