mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Add --quiet to pre-commit install
This commit is contained in:
parent
7aacceff93
commit
db412bc67d
2 changed files with 11 additions and 1 deletions
|
|
@ -77,6 +77,7 @@ def _install_hook_script(
|
|||
config_file: str,
|
||||
hook_type: str,
|
||||
overwrite: bool = False,
|
||||
quiet: bool = False,
|
||||
skip_on_missing_config: bool = False,
|
||||
git_dir: Optional[str] = None,
|
||||
) -> None:
|
||||
|
|
@ -98,6 +99,8 @@ def _install_hook_script(
|
|||
)
|
||||
|
||||
args = ['hook-impl', f'--config={config_file}', f'--hook-type={hook_type}']
|
||||
if quiet:
|
||||
args.append('--quiet')
|
||||
if skip_on_missing_config:
|
||||
args.append('--skip-on-missing-config')
|
||||
params = {'INSTALL_PYTHON': sys.executable, 'ARGS': args}
|
||||
|
|
@ -125,6 +128,7 @@ def install(
|
|||
hook_types: Sequence[str],
|
||||
overwrite: bool = False,
|
||||
hooks: bool = False,
|
||||
quiet: bool = False,
|
||||
skip_on_missing_config: bool = False,
|
||||
git_dir: Optional[str] = None,
|
||||
) -> int:
|
||||
|
|
@ -139,6 +143,7 @@ def install(
|
|||
_install_hook_script(
|
||||
config_file, hook_type,
|
||||
overwrite=overwrite,
|
||||
quiet=quiet,
|
||||
skip_on_missing_config=skip_on_missing_config,
|
||||
git_dir=git_dir,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|||
'--skip-on-missing-config', action='store_true',
|
||||
)
|
||||
hook_impl_parser.add_argument(
|
||||
'--quiet', action='store_true', default=False,
|
||||
'--quiet', '-q', action='store_true', default=False,
|
||||
help='Enable quiet mode (in post-commit, pre-merge-commit, '
|
||||
'pre-commit hooks).',
|
||||
)
|
||||
|
|
@ -270,6 +270,10 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|||
),
|
||||
)
|
||||
_add_hook_type_option(install_parser)
|
||||
install_parser.add_argument(
|
||||
'--quiet', '-q', action='store_true', default=False,
|
||||
help='Write hook script using quiet mode.',
|
||||
)
|
||||
install_parser.add_argument(
|
||||
'--allow-missing-config', action='store_true', default=False,
|
||||
help=(
|
||||
|
|
@ -384,6 +388,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|||
hook_types=args.hook_types,
|
||||
overwrite=args.overwrite,
|
||||
hooks=args.install_hooks,
|
||||
quiet=args.quiet,
|
||||
skip_on_missing_config=args.allow_missing_config,
|
||||
)
|
||||
elif args.command == 'init-templatedir':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue