Skip to content

Commit b01119e

Browse files
woileLee-W
authored andcommitted
docs: add author and author_email example
1 parent 95ec261 commit b01119e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

‎docs/customization.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ message = "Do you want to add body message in commit?"
6060

6161
#### Detailed `questions` content
6262

63-
| Parameter | Type | Default | Description |
64-
| --------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65-
| `type` | `str` | `None` | The type of questions. Valid type: `list`, `input` and etc. [See More](https://github.com/tmbo/questionary#different-question-types) |
66-
| `name` | `str` | `None` | The key for the value answered by user. It's used in `message_template` |
67-
| `message` | `str` | `None` | Detail description for the question. |
63+
| Parameter | Type | Default | Description |
64+
| --------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
65+
| `type` | `str` | `None` | The type of questions. Valid type: `list`, `input` and etc. [See More](https://github.com/tmbo/questionary#different-question-types) |
66+
| `name` | `str` | `None` | The key for the value answered by user. It's used in `message_template` |
67+
| `message` | `str` | `None` | Detail description for the question. |
6868
| `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. |
69-
| `default` | `Any` | `None` | (OPTIONAL) The default value for this question. |
70-
| `filter` | `str` | `None` | (Optional) Validator for user's answer. **(Work in Progress)** |
69+
| `default` | `Any` | `None` | (OPTIONAL) The default value for this question. |
70+
| `filter` | `str` | `None` | (Optional) Validator for user's answer. **(Work in Progress)** |
7171

7272
## 2. Customize through customizing a class
7373

@@ -206,13 +206,13 @@ cz -n cz_strange bump
206206
The changelog generator should just work in a very basic manner without touching anything.
207207
You can customize it of course, and this are the variables you need to add to your custom `BaseCommitizen`.
208208

209-
| Parameter | Type | Required | Description |
210-
| ------------------- | ------------------------------------------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
211-
| `commit_parser` | `str` | NO | Regex which should provide the variables explained in the [changelog description][changelog-des] |
212-
| `changelog_pattern` | `str` | NO | Regex to validate the commits, this is useful to skip commits that don't meet your rulling standards like a Merge. Usually the same as bump_pattern |
213-
| `change_type_map` | `dict` | NO | Convert the title of the change type that will appear in the changelog, if a value is not found, the original will be provided |
214-
| `changelog_message_builder_hook` | `method: (dict, git.GitCommit) -> dict` | NO | Customize with extra information your message output, like adding links, this function is executed per parsed commit. |
215-
| `changelog_hook` | `method: (full_changelog: str, partial_changelog: Optional[str]) -> str` | NO | Receives the whole and partial (if used incremental) changelog. Useful to send slack messages or notify a compliance department. Must return the full_changelog |
209+
| Parameter | Type | Required | Description |
210+
| -------------------------------- | ------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
211+
| `commit_parser` | `str` | NO | Regex which should provide the variables explained in the [changelog description][changelog-des] |
212+
| `changelog_pattern` | `str` | NO | Regex to validate the commits, this is useful to skip commits that don't meet your rulling standards like a Merge. Usually the same as bump_pattern |
213+
| `change_type_map` | `dict` | NO | Convert the title of the change type that will appear in the changelog, if a value is not found, the original will be provided |
214+
| `changelog_message_builder_hook` | `method: (dict, git.GitCommit) -> dict` | NO | Customize with extra information your message output, like adding links, this function is executed per parsed commit. Each GitCommit contains the following attrs: `rev`, `title`, `body`, `author`, `author_email` |
215+
| `changelog_hook` | `method: (full_changelog: str, partial_changelog: Optional[str]) -> str` | NO | Receives the whole and partial (if used incremental) changelog. Useful to send slack messages or notify a compliance department. Must return the full_changelog |
216216

217217
```python
218218
from commitizen.cz.base import BaseCommitizen
@@ -232,7 +232,7 @@ class StrangeCommitizen(BaseCommitizen):
232232
def changelog_message_builder_hook(self, parsed_message: dict, commit: git.GitCommit) -> dict:
233233
rev = commit.rev
234234
m = parsed_message["message"]
235-
parsed_message["message"] = f"{m} {rev}"
235+
parsed_message["message"] = f"{m} {rev} [{commit.author}]({commit.author_email})"
236236
return parsed_message
237237

238238
def changelog_hook(self, full_changelog: str, partial_changelog: Optional[str]) -> str:

0 commit comments

Comments
 (0)