Skip to content

Commit d44ade8

Browse files
committed
docs(cz/customize): update doc for jinja support
#54
1 parent c130d5e commit d44ade8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/customization.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Example:
151151
name = "cz_customize"
152152

153153
[tool.commitizen.customize]
154-
message_template = "{change_type}: {message}"
154+
message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}"
155155
example = "feature: this feature eanable customize through config file"
156156
schema = "<type>: <body>"
157157
bump_pattern = "^(break|new|fix|hotfix)"
@@ -171,14 +171,19 @@ message = "Select the type of change you are committing"
171171
type = "input"
172172
name = "message"
173173
message = "Body."
174+
175+
[[tool.commitizen.customize.questions]]
176+
type = "confirm"
177+
name = "show_message"
178+
message = "Do you want to add body message in commit?"
174179
```
175180

176181
### Customize configuration
177182

178183
| Parameter | Type | Default | Description |
179184
| --------- | ---- | ------- | ----------- |
180185
| `question` | `dict` | `None` | Questions regarding the commit message. Detatiled below. |
181-
| `message_template` | `str` | `None` | The template for generating message from the given answers. `message_template` should follow the python string formatting specification, and all the variables in this template should be defined in `name` in `questions`. |
186+
| `message_template` | `str` | `None` | The template for generating message from the given answers. `message_template` should follow the [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`. |
182187
| `example` | `str` | `None` | (OPTIONAL) Provide an example to help understand the style. Used by `cz example`. |
183188
| `schema` | `str` | `None` | (OPTIONAL) Show the schema used. Used by `cz schema`. |
184189
| `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. |

tests/test_cz_customize.py

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def config():
1010
_conf = Config()
1111
toml_str = r"""
1212
[tool.commitizen.customize]
13-
# message_template should follow the python string formatting spec
1413
message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}"
1514
example = "feature: this feature eanable customize through config file"
1615
schema = "<type>: <body>"

0 commit comments

Comments
 (0)