Skip to content

Commit c5a9f67

Browse files
TatshLee-W
authored andcommitted
docs(third-party-commitizen.md): Add cz-path info
1 parent b2e9c1b commit c5a9f67

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/third-party-commitizen.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,56 @@ commitizen:
145145
version_provider: deno-provider
146146
version_scheme: semver
147147
```
148+
149+
### [cz-path](https://pypi.org/project/cz-path/)
150+
151+
Provides prefix choices for commit messages based on staged files (Git only).
152+
For example, if the staged files are `component/z/a.ts` and `component/z/b.ts`,
153+
the path prefix option will be `component/z` and commit message might look like:
154+
`component/z/: description of changes`. If only one file is staged, the extension
155+
is removed in the prefix.
156+
157+
#### Installation
158+
159+
```sh
160+
pip install cz-path
161+
```
162+
163+
#### Usage
164+
165+
Add `cz-path` to your configuration file.
166+
167+
Example for `.cz.json`:
168+
169+
```json
170+
{
171+
"commitizen": {
172+
"name": "cz_path",
173+
"remove_path_prefixes": ["src", "module_name"]
174+
}
175+
}
176+
```
177+
178+
The default value for `remove_path_prefixes` is `["src"]`. Adding `/` to the
179+
prefixes is not required.
180+
181+
#### Example session
182+
183+
```plain
184+
$ git add .vscode/
185+
$ cz -n cz_path c
186+
? Prefix: (Use arrow keys)
187+
» .vscode
188+
.vscode/
189+
project
190+
(empty)
191+
? Prefix: .vscode
192+
? Commit title: adjust settings
193+
194+
.vscode: adjust settings
195+
196+
[main 0000000] .vscode: adjust settings
197+
2 files changed, 1 insertion(+), 11 deletions(-)
198+
199+
Commit successful!
200+
```

0 commit comments

Comments
 (0)