Skip to content

Commit 211bcb3

Browse files
authored
docs: document and demo use_shortcuts keyboard shortcuts (#1891)
1 parent 6c91b45 commit 211bcb3

File tree

8 files changed

+673
-314
lines changed

8 files changed

+673
-314
lines changed

docs/config/configuration_file.md

Lines changed: 176 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -48,182 +48,182 @@ All formats support the same configuration options. Choose the format that best
4848

4949
## Configuration Structure
5050

51-
### TOML Format
52-
53-
For TOML files, Commitizen settings are placed under the `[tool.commitizen]` section. If you're using a standalone `.cz.toml` or `cz.toml` file, you can use `[tool.commitizen]` or just `[commitizen]`.
54-
55-
**Example: `pyproject.toml`, `.cz.toml` or `cz.toml`**
56-
57-
```toml title="pyproject.toml"
58-
[tool.commitizen]
59-
name = "cz_conventional_commits"
60-
version = "0.1.0"
61-
version_provider = "commitizen"
62-
version_scheme = "pep440"
63-
version_files = [
64-
"src/__version__.py",
65-
"pyproject.toml:version"
66-
]
67-
tag_format = "$version"
68-
update_changelog_on_bump = true
69-
changelog_file = "CHANGELOG.md"
70-
changelog_incremental = false
71-
bump_message = "bump: version $current_version → $new_version"
72-
gpg_sign = false
73-
annotated_tag = false
74-
major_version_zero = false
75-
prerelease_offset = 0
76-
retry_after_failure = false
77-
allow_abort = false
78-
message_length_limit = 0
79-
allowed_prefixes = [
80-
"Merge",
81-
"Revert",
82-
"Pull request",
83-
"fixup!",
84-
"squash!",
85-
"amend!"
86-
]
87-
breaking_change_exclamation_in_title = false
88-
use_shortcuts = false
89-
pre_bump_hooks = []
90-
post_bump_hooks = []
91-
encoding = "utf-8"
92-
93-
# Optional: Custom styling for prompts
94-
style = [
95-
["qmark", "fg:#ff9d00 bold"],
96-
["question", "bold"],
97-
["answer", "fg:#ff9d00 bold"],
98-
["pointer", "fg:#ff9d00 bold"],
99-
["highlighted", "fg:#ff9d00 bold"],
100-
["selected", "fg:#cc5454"],
101-
["separator", "fg:#cc5454"],
102-
["instruction", ""],
103-
["text", ""],
104-
["disabled", "fg:#858585 italic"]
105-
]
106-
```
107-
108-
### JSON Format
109-
110-
For JSON files, Commitizen settings are placed under the `commitizen` key.
111-
112-
**Example: `.cz.json` or `cz.json`**
113-
114-
```json title=".cz.json"
115-
{
116-
"commitizen": {
117-
"name": "cz_conventional_commits",
118-
"version": "0.1.0",
119-
"version_provider": "commitizen",
120-
"version_scheme": "pep440",
121-
"version_files": [
122-
"src/__version__.py",
123-
"pyproject.toml:version"
124-
],
125-
"tag_format": "$version",
126-
"update_changelog_on_bump": true,
127-
"changelog_file": "CHANGELOG.md",
128-
"changelog_incremental": false,
129-
"bump_message": "bump: version $current_version → $new_version",
130-
"gpg_sign": false,
131-
"annotated_tag": false,
132-
"major_version_zero": false,
133-
"prerelease_offset": 0,
134-
"retry_after_failure": false,
135-
"allow_abort": false,
136-
"message_length_limit": 0,
137-
"allowed_prefixes": [
138-
"Merge",
139-
"Revert",
140-
"Pull request",
141-
"fixup!",
142-
"squash!",
143-
"amend!"
144-
],
145-
"breaking_change_exclamation_in_title": false,
146-
"use_shortcuts": false,
147-
"pre_bump_hooks": [],
148-
"post_bump_hooks": [],
149-
"encoding": "utf-8",
150-
"style": [
151-
["qmark", "fg:#ff9d00 bold"],
152-
["question", "bold"],
153-
["answer", "fg:#ff9d00 bold"],
154-
["pointer", "fg:#ff9d00 bold"],
155-
["highlighted", "fg:#ff9d00 bold"],
156-
["selected", "fg:#cc5454"],
157-
["separator", "fg:#cc5454"],
158-
["instruction", ""],
159-
["text", ""],
160-
["disabled", "fg:#858585 italic"]
51+
=== "TOML Format"
52+
53+
For TOML files, Commitizen settings are placed under the `[tool.commitizen]` section. If you're using a standalone `.cz.toml` or `cz.toml` file, you can use `[tool.commitizen]` or just `[commitizen]`.
54+
55+
**Example: `pyproject.toml`, `.cz.toml` or `cz.toml`**
56+
57+
```toml title="pyproject.toml"
58+
[tool.commitizen]
59+
name = "cz_conventional_commits"
60+
version = "0.1.0"
61+
version_provider = "commitizen"
62+
version_scheme = "pep440"
63+
version_files = [
64+
"src/__version__.py",
65+
"pyproject.toml:version"
66+
]
67+
tag_format = "$version"
68+
update_changelog_on_bump = true
69+
changelog_file = "CHANGELOG.md"
70+
changelog_incremental = false
71+
bump_message = "bump: version $current_version → $new_version"
72+
gpg_sign = false
73+
annotated_tag = false
74+
major_version_zero = false
75+
prerelease_offset = 0
76+
retry_after_failure = false
77+
allow_abort = false
78+
message_length_limit = 0
79+
allowed_prefixes = [
80+
"Merge",
81+
"Revert",
82+
"Pull request",
83+
"fixup!",
84+
"squash!",
85+
"amend!"
86+
]
87+
breaking_change_exclamation_in_title = false
88+
use_shortcuts = false
89+
pre_bump_hooks = []
90+
post_bump_hooks = []
91+
encoding = "utf-8"
92+
93+
# Optional: Custom styling for prompts
94+
style = [
95+
["qmark", "fg:#ff9d00 bold"],
96+
["question", "bold"],
97+
["answer", "fg:#ff9d00 bold"],
98+
["pointer", "fg:#ff9d00 bold"],
99+
["highlighted", "fg:#ff9d00 bold"],
100+
["selected", "fg:#cc5454"],
101+
["separator", "fg:#cc5454"],
102+
["instruction", ""],
103+
["text", ""],
104+
["disabled", "fg:#858585 italic"]
161105
]
162-
}
163-
}
164-
```
165-
166-
### YAML Format
167-
168-
For YAML files, Commitizen settings are placed under the `commitizen` key.
169-
170-
**Example: `.cz.yaml` or `cz.yaml`**
171-
172-
```yaml title=".cz.yaml"
173-
commitizen:
174-
name: cz_conventional_commits
175-
version: "0.1.0"
176-
version_provider: commitizen
177-
version_scheme: pep440
178-
version_files:
179-
- src/__version__.py
180-
- pyproject.toml:version
181-
tag_format: "$version"
182-
update_changelog_on_bump: true
183-
changelog_file: CHANGELOG.md
184-
changelog_incremental: false
185-
bump_message: "bump: version $current_version → $new_version"
186-
gpg_sign: false
187-
annotated_tag: false
188-
major_version_zero: false
189-
prerelease_offset: 0
190-
retry_after_failure: false
191-
allow_abort: false
192-
message_length_limit: 0
193-
allowed_prefixes:
194-
- Merge
195-
- Revert
196-
- Pull request
197-
- fixup!
198-
- squash!
199-
- amend!
200-
breaking_change_exclamation_in_title: false
201-
use_shortcuts: false
202-
pre_bump_hooks: []
203-
post_bump_hooks: []
204-
encoding: utf-8
205-
style:
206-
- - qmark
207-
- fg:#ff9d00 bold
208-
- - question
209-
- bold
210-
- - answer
211-
- fg:#ff9d00 bold
212-
- - pointer
213-
- fg:#ff9d00 bold
214-
- - highlighted
215-
- fg:#ff9d00 bold
216-
- - selected
217-
- fg:#cc5454
218-
- - separator
219-
- fg:#cc5454
220-
- - instruction
221-
- ""
222-
- - text
223-
- ""
224-
- - disabled
225-
- fg:#858585 italic
226-
```
106+
```
107+
108+
=== "JSON Format"
109+
110+
For JSON files, Commitizen settings are placed under the `commitizen` key.
111+
112+
**Example: `.cz.json` or `cz.json`**
113+
114+
```json title=".cz.json"
115+
{
116+
"commitizen": {
117+
"name": "cz_conventional_commits",
118+
"version": "0.1.0",
119+
"version_provider": "commitizen",
120+
"version_scheme": "pep440",
121+
"version_files": [
122+
"src/__version__.py",
123+
"pyproject.toml:version"
124+
],
125+
"tag_format": "$version",
126+
"update_changelog_on_bump": true,
127+
"changelog_file": "CHANGELOG.md",
128+
"changelog_incremental": false,
129+
"bump_message": "bump: version $current_version → $new_version",
130+
"gpg_sign": false,
131+
"annotated_tag": false,
132+
"major_version_zero": false,
133+
"prerelease_offset": 0,
134+
"retry_after_failure": false,
135+
"allow_abort": false,
136+
"message_length_limit": 0,
137+
"allowed_prefixes": [
138+
"Merge",
139+
"Revert",
140+
"Pull request",
141+
"fixup!",
142+
"squash!",
143+
"amend!"
144+
],
145+
"breaking_change_exclamation_in_title": false,
146+
"use_shortcuts": false,
147+
"pre_bump_hooks": [],
148+
"post_bump_hooks": [],
149+
"encoding": "utf-8",
150+
"style": [
151+
["qmark", "fg:#ff9d00 bold"],
152+
["question", "bold"],
153+
["answer", "fg:#ff9d00 bold"],
154+
["pointer", "fg:#ff9d00 bold"],
155+
["highlighted", "fg:#ff9d00 bold"],
156+
["selected", "fg:#cc5454"],
157+
["separator", "fg:#cc5454"],
158+
["instruction", ""],
159+
["text", ""],
160+
["disabled", "fg:#858585 italic"]
161+
]
162+
}
163+
}
164+
```
165+
166+
=== "YAML Format"
167+
168+
For YAML files, Commitizen settings are placed under the `commitizen` key.
169+
170+
**Example: `.cz.yaml` or `cz.yaml`**
171+
172+
```yaml title=".cz.yaml"
173+
commitizen:
174+
name: cz_conventional_commits
175+
version: "0.1.0"
176+
version_provider: commitizen
177+
version_scheme: pep440
178+
version_files:
179+
- src/__version__.py
180+
- pyproject.toml:version
181+
tag_format: "$version"
182+
update_changelog_on_bump: true
183+
changelog_file: CHANGELOG.md
184+
changelog_incremental: false
185+
bump_message: "bump: version $current_version → $new_version"
186+
gpg_sign: false
187+
annotated_tag: false
188+
major_version_zero: false
189+
prerelease_offset: 0
190+
retry_after_failure: false
191+
allow_abort: false
192+
message_length_limit: 0
193+
allowed_prefixes:
194+
- Merge
195+
- Revert
196+
- Pull request
197+
- fixup!
198+
- squash!
199+
- amend!
200+
breaking_change_exclamation_in_title: false
201+
use_shortcuts: false
202+
pre_bump_hooks: []
203+
post_bump_hooks: []
204+
encoding: utf-8
205+
style:
206+
- - qmark
207+
- fg:#ff9d00 bold
208+
- - question
209+
- bold
210+
- - answer
211+
- fg:#ff9d00 bold
212+
- - pointer
213+
- fg:#ff9d00 bold
214+
- - highlighted
215+
- fg:#ff9d00 bold
216+
- - selected
217+
- fg:#cc5454
218+
- - separator
219+
- fg:#cc5454
220+
- - instruction
221+
- ""
222+
- - text
223+
- ""
224+
- - disabled
225+
- fg:#858585 italic
226+
```
227227

228228
## Configuration Options
229229

@@ -244,4 +244,4 @@ Key configuration categories include:
244244
For advanced customization, including creating custom commit rules, see the [Customization](../customization/config_file.md) documentation.
245245

246246
!!! note
247-
The `customize` option is only supported when using TOML configuration files.
247+
The `customize` option is supported in TOML, JSON, and YAML configuration files. For Python projects, adding it to `pyproject.toml` keeps all project configuration in one place.

docs/config/option.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Style for the prompts (It will merge this value with default style.) See [Stylin
2626
- Type: `dict`
2727
- Default: `None`
2828

29-
**This is only supported when config through `toml` configuration file.**
29+
**Supported in TOML, JSON, and YAML configuration files.**
3030

3131
Custom rules for committing and bumping. See [customization](../customization/config_file.md) for more details.
3232

@@ -35,4 +35,18 @@ Custom rules for committing and bumping. See [customization](../customization/co
3535
- Type: `bool`
3636
- Default: `False`
3737

38-
Show keyboard shortcuts when selecting from a list. Define a `key` for each of your choices to set the key. See [shortcut keys](../customization/config_file.md#shortcut-keys) for more details.
38+
Show keyboard shortcuts when selecting from a list. When enabled, each choice shows a shortcut key; press that key or use the arrow keys to select.
39+
40+
Example:
41+
42+
```toml title="pyproject.toml"
43+
[tool.commitizen]
44+
name = "cz_conventional_commits"
45+
use_shortcuts = true
46+
```
47+
48+
Run `cz commit` to see shortcut keys on each choice.
49+
50+
![Menu with shortcut keys](../images/cli_interactive/shortcut_default.gif)
51+
52+
To customize which key is used for each choice (via the `key` field when using `cz_customize`), see [shortcut keys customization](../customization/config_file.md#shortcut-keys).

0 commit comments

Comments
 (0)