mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 10:31:46 +04:00
New option to auto-add files modified by hooks
This commit is contained in:
parent
858e89865e
commit
094f8aa0a4
4 changed files with 21 additions and 1 deletions
|
|
@ -108,6 +108,15 @@ def _add_run_options(parser):
|
|||
'Equivalent to setting the environment variable '
|
||||
'PRE_COMMIT_MODIFIED_FILES_OK=true.',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--add-modified', action='store_true',
|
||||
default='PRE_COMMIT_ADD_MODIFIED_FILES' in os.environ,
|
||||
help='Any file modifications made by hooks will be automatically '
|
||||
'added to the index unless any hook fails. When set, file '
|
||||
"modification by hooks won't be equated with failure (same as if "
|
||||
'--modified-files-ok is set). Equivalent to setting the '
|
||||
'environment variable PRE_COMMIT_ADD_MODIFIED_FILES=true.',
|
||||
)
|
||||
mutex_group = parser.add_mutually_exclusive_group(required=False)
|
||||
mutex_group.add_argument(
|
||||
'--all-files', '-a', action='store_true', default=False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue