pre_commit: expose fail-fast argument for run subcommand

This patch exposes the fail-fast feature as a command-line argument for the run
subcommand, allowing to run pre-commit to stop at the first failed hook without
the need of temporarily writing it to the configuration file when temporarily
needed.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
This commit is contained in:
Luís Ferreira 2021-10-03 00:34:39 +01:00
parent d021bbfabd
commit 61efc539a4
No known key found for this signature in database
GPG key ID: 730750D54B7A9F66
5 changed files with 23 additions and 2 deletions

View file

@ -85,6 +85,10 @@ def _add_run_options(parser: argparse.ArgumentParser) -> None:
'--all-files', '-a', action='store_true', default=False,
help='Run on all the files in the repo.',
)
mutex_group.add_argument(
'--fail-fast', action='store_true',
help='Stop running hooks after the first failure',
)
mutex_group.add_argument(
'--files', nargs='*', default=[],
help='Specific filenames to run hooks on.',