mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 16:44:42 +04:00
Add --hook-args option to try-repo
This commit is contained in:
parent
99fa9ba5ef
commit
6d22fc01d0
3 changed files with 53 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ import argparse
|
|||
import logging
|
||||
import os.path
|
||||
import tempfile
|
||||
import warnings
|
||||
|
||||
import pre_commit.constants as C
|
||||
from pre_commit import git
|
||||
|
|
@ -54,8 +55,15 @@ def try_repo(args: argparse.Namespace) -> int:
|
|||
|
||||
store = Store(tempdir)
|
||||
if args.hook:
|
||||
hooks = [{'id': args.hook}]
|
||||
hook = {'id': args.hook}
|
||||
if args.hook_args is not None:
|
||||
hook['args'] = args.hook_args
|
||||
hooks = [hook]
|
||||
else:
|
||||
if args.hook_args is not None:
|
||||
warnings.warn(
|
||||
"Unused flag '--hook-args' as 'hook' is not specified.",
|
||||
)
|
||||
repo_path = store.clone(repo, ref)
|
||||
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
|
||||
manifest = sorted(manifest, key=lambda hook: hook['id'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue