Skip to content

Commit 90c9918

Browse files
zevisertLee-W
authored andcommitted
docs(shortcuts): update to include info about keyboard shortcut options
1 parent e333537 commit 90c9918

File tree

2 files changed

+48
-31
lines changed

2 files changed

+48
-31
lines changed

docs/config.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,21 @@ commitizen:
122122
123123
## Settings
124124
125-
| Variable | Type | Default | Description |
126-
| -------- | ---- | ------- | ----------- |
127-
| `name` | `str` | `"cz_conventional_commits"` | Name of the committing rules to use |
128-
| `version` | `str` | `None` | Current version. Example: "0.1.2" |
129-
| `version_files` | `list` | `[ ]` | Files were the version will be updated. A pattern to match a line, can also be specified, separated by `:` [See more](https://commitizen-tools.github.io/commitizen/bump/#version_files) |
130-
| `tag_format` | `str` | `None` | Format for the git tag, useful for old projects, that use a convention like `"v1.2.1"`. [See more](https://commitizen-tools.github.io/commitizen/bump/#tag_format) |
131-
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more](https://commitizen-tools.github.io/commitizen/bump/#bump_message) |
132-
| `changelog_file` | `str` | `CHANGELOG.md` | filename of exported changelog |
133-
| `style` | `list` | see above | Style for the prompts (It will merge this value with default style.) [See More (Styling your prompts with your favorite colors)](https://github.com/tmbo/questionary#additional-features) |
134-
| `customize` | `dict` | `None` | **This is only supported when config through `toml`.** Custom rules for committing and bumping. [See more](https://commitizen-tools.github.io/commitizen/customization/) |
125+
| Variable | Type | Default | Description |
126+
| ---------------- | ------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
127+
| `name` | `str` | `"cz_conventional_commits"` | Name of the committing rules to use |
128+
| `version` | `str` | `None` | Current version. Example: "0.1.2" |
129+
| `version_files` | `list` | `[ ]` | Files were the version will be updated. A pattern to match a line, can also be specified, separated by `:` [See more](version_files) |
130+
| `tag_format` | `str` | `None` | Format for the git tag, useful for old projects, that use a convention like `"v1.2.1"`. [See more](tag_format) |
131+
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more](bump_message) |
132+
| `changelog_file` | `str` | `CHANGELOG.md` | filename of exported changelog |
133+
| `style` | `list` | see above | Style for the prompts (It will merge this value with default style.) [See More (Styling your prompts with your favorite colors)](additional-features) |
134+
| `customize` | `dict` | `None` | **This is only supported when config through `toml`.** Custom rules for committing and bumping. [See more](customization) |
135+
| `use_shortcuts` | `bool` | `false` | If enabled, commitizen will show keyboard shortcuts when selecting from a list. Define a `key` for each of your choices to set the key. [See more](shortcuts) |
136+
137+
[version_files]: https://commitizen-tools.github.io/commitizen/bump/#version_files
138+
[tag_format]: https://commitizen-tools.github.io/commitizen/bump/#tag_format
139+
[bump_message]: https://commitizen-tools.github.io/commitizen/bump/#bump_message
140+
[additional-features]: https://github.com/tmbo/questionary#additional-features
141+
[customization]: https://commitizen-tools.github.io/commitizen/customization/
142+
[shortcuts]: https://commitizen-tools.github.io/commitizen/customization/#shortcut-keys

docs/customization.md

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,39 @@ commitizen:
138138
139139
### Customize configuration
140140
141-
| Parameter | Type | Default | Description |
142-
| ------------------ | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
143-
| `questions` | `dict` | `None` | Questions regarding the commit message. Detailed below. |
144-
| `message_template` | `str` | `None` | The template for generating message from the given answers. `message_template` should either follow [Jinja2](https://jinja.palletsprojects.com/en/2.10.x/) formatting specification, and all the variables in this template should be defined in `name` in `questions` |
145-
| `example` | `str` | `None` | (OPTIONAL) Provide an example to help understand the style. Used by `cz example`. |
146-
| `schema` | `str` | `None` | (OPTIONAL) Show the schema used. Used by `cz schema`. |
147-
| `schema_pattern` | `str` | `None` | (OPTIONAL) The regular expression used to do commit message validation. Used by `cz check`. |
148-
| `info_path` | `str` | `None` | (OPTIONAL) The path to the file that contains explanation of the commit rules. Used by `cz info`. If not provided `cz info`, will load `info` instead. |
149-
| `info` | `str` | `None` | (OPTIONAL) Explanation of the commit rules. Used by `cz info`. |
150-
| `bump_map` | `dict` | `None` | (OPTIONAL) Dictionary mapping the extracted information to a `SemVer` increment type (`MAJOR`, `MINOR`, `PATCH`) |
151-
| `bump_pattern` | `str` | `None` | (OPTIONAL) Regex to extract information from commit (subject and body) |
152-
| `change_type_order`| `str` | `None` | (OPTIONAL) List of strings used to order the Changelog. All other types will be sorted alphabetically. Default is `["BREAKING CHANGE", "feat", "fix", "refactor", "perf"]` |
153-
141+
| Parameter | Type | Default | Description |
142+
| ------------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
143+
| `questions` | `dict` | `None` | Questions regarding the commit message. Detailed below. |
144+
| `message_template` | `str` | `None` | The template for generating message from the given answers. `message_template` should either follow [Jinja2][jinja2] formatting specification, and all the variables in this template should be defined in `name` in `questions` |
145+
| `example` | `str` | `None` | (OPTIONAL) Provide an example to help understand the style. Used by `cz example`. |
146+
| `schema` | `str` | `None` | (OPTIONAL) Show the schema used. Used by `cz schema`. |
147+
| `schema_pattern` | `str` | `None` | (OPTIONAL) The regular expression used to do commit message validation. Used by `cz check`. |
148+
| `info_path` | `str` | `None` | (OPTIONAL) The path to the file that contains explanation of the commit rules. Used by `cz info`. If not provided `cz info`, will load `info` instead. |
149+
| `info` | `str` | `None` | (OPTIONAL) Explanation of the commit rules. Used by `cz info`. |
150+
| `bump_map` | `dict` | `None` | (OPTIONAL) Dictionary mapping the extracted information to a `SemVer` increment type (`MAJOR`, `MINOR`, `PATCH`) |
151+
| `bump_pattern` | `str` | `None` | (OPTIONAL) Regex to extract information from commit (subject and body) |
152+
| `change_type_order` | `str` | `None` | (OPTIONAL) List of strings used to order the Changelog. All other types will be sorted alphabetically. Default is `["BREAKING CHANGE", "feat", "fix", "refactor", "perf"]` |
153+
154+
[jinja2]: https://jinja.palletsprojects.com/en/2.10.x/
154155
#### Detailed `questions` content
155156

156-
| Parameter | Type | Default | Description |
157-
| --------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
158-
| `type` | `str` | `None` | The type of questions. Valid type: `list`, `input` and etc. [See More](https://github.com/tmbo/questionary#different-question-types) |
159-
| `name` | `str` | `None` | The key for the value answered by user. It's used in `message_template` |
160-
| `message` | `str` | `None` | Detail description for the question. |
161-
| `choices` | `list` | `None` | (OPTIONAL) The choices when `type = list`. Either use a list of values or a list of dicitionaries with `name` and `value` keys. See examples above. |
162-
| `default` | `Any` | `None` | (OPTIONAL) The default value for this question. |
163-
| `filter` | `str` | `None` | (Optional) Validator for user's answer. **(Work in Progress)** |
157+
| Parameter | Type | Default | Description |
158+
| --------- | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
159+
| `type` | `str` | `None` | The type of questions. Valid type: `list`, `input` and etc. [See More][different-question-types] |
160+
| `name` | `str` | `None` | The key for the value answered by user. It's used in `message_template` |
161+
| `message` | `str` | `None` | Detail description for the question. |
162+
| `choices` | `list` | `None` | (OPTIONAL) The choices when `type = list`. Either use a list of values or a list of dictionaries with `name` and `value` keys. Keyboard shortcuts can be defined via `key`. See examples above. |
163+
| `default` | `Any` | `None` | (OPTIONAL) The default value for this question. |
164+
| `filter` | `str` | `None` | (Optional) Validator for user's answer. **(Work in Progress)** |
165+
166+
[different-question-types]: https://github.com/tmbo/questionary#different-question-types
167+
168+
#### Shortcut keys
164169

170+
When the [`use_shortcuts`](https://commitizen-tools.github.io/commitizen/config/#settings) config option is enabled, commitizen can show and use keyboard shortcuts to select items from lists directly.
171+
For example, when using the `cz_conventional_commits` commitizen template, shortcut keys are shown when selecting the commit type. Unless otherwise defined, keyboard shortcuts will be numbered automatically.
172+
To specify keyboard shortcuts for your custom choices, provide the shortcut using the `key` parameter in dictionary form for each choice you would like to customize.
173+
165174
## 2. Customize through customizing a class
166175

167176
The basic steps are:

0 commit comments

Comments
 (0)