Skip to content

Commit c2648ea

Browse files
committed
Updates docs for '--' usage
1 parent 5a69fed commit c2648ea

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ You can copy/paste the following snippet into your `.pre-commit-config.yaml` fil
2020
# Visit the project home page to learn more about the available Hooks,
2121
# including useful arguments you might want to pass into them.
2222
#
23-
# When passing options to hooks, use a trailing '--' argument to separate
24-
# the hook options from the modified-file list that Pre-Commit passes in.
25-
# For repo-based hooks, the '--' is optional.
23+
# NOTE: When passing options to hooks, if your options contain a reference
24+
# to an existing file, then you will need to use a trailing '--'
25+
# argument to separate the hook options from the modified-file list
26+
# that Pre-Commit passes into the hook.
27+
# For repo-based hooks, '--' is not needed.
2628
#
2729
# Consider adding aliases to longer-named hooks for easier CLI usage.
2830
# ==========================================================================
@@ -125,17 +127,19 @@ For file and repo-based hooks, this isn't an issue, but for module and package-b
125127
### Useful Hook Parameters
126128
```
127129
- id: hook-id
128-
args: [arg1, arg2, ..., '--'] # Pass options (end with '--')
130+
args: [arg1, arg2, ..., '--'] # Pass options ('--' is optional)
129131
always_run: true # Run even if no matching files staged
130132
alias: hook-alias # Create an alias
131133
```
132134
133135
#### Passing Options To Hooks
134136
You can pass options into individual hooks to customize tool behavior.
135137
136-
Use a trailing `'--'` argument to separate the hook options from the modified-file list that Pre-Commit passes into the hook.
138+
If your options contain a reference to an existing file, then you
139+
will need to use a trailing `'--'` argument to separate the hook options from
140+
the modified-file list that Pre-Commit passes into the hook.
137141
138-
For repo-based hooks, the `'--'` is optional
142+
**NOTE:** For repo-based hooks, `'--'` is not needed.
139143
140144
See each hook's description below for some popular options that you might want to use.
141145

sample-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ repos:
5353
#
5454
# Useful Hook Parameters:
5555
# - id: hook-id
56-
# args: [arg1, arg2, ..., '--'] # Pass options (end with '--')
56+
# args: [arg1, arg2, ..., '--'] # Pass options ('--' is optional)
5757
# always_run: true # Run even if no matching files staged
5858
# alias: hook-alias # Create an alias
5959
#
6060
# Passing Options To Hooks:
61-
# You can pass options into individual hooks to customize tool behavior.
62-
# Use a trailing '--' argument to separate the hook options from the
63-
# modified-file list that Pre-Commit passes into the hook.
64-
# For repo-based hooks, the '--' is optional.
61+
# If your options contain a reference to an existing file, then you will
62+
# need to use a trailing '--' argument to separate the hook options from
63+
# the modified-file list that Pre-Commit passes into the hook.
64+
# NOTE: For repo-based hooks, '--' is not needed.
6565
#
6666
# Always Run:
6767
# By default, hooks ONLY run when matching file types are staged.

0 commit comments

Comments
 (0)