Skip to content

Commit 401ccd0

Browse files
committed
wip
1 parent fc7a2f1 commit 401ccd0

File tree

3 files changed

+50
-105
lines changed

3 files changed

+50
-105
lines changed

docs/commands/changelog.md

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,25 @@ This command will generate a changelog following the committing rules establishe
1414

1515
![cz changelog --help](../images/cli_help/cz_changelog___help.svg)
1616

17-
### Examples
18-
19-
#### Generate full changelog
17+
## Examples
2018

2119
```bash
20+
# Generate full changelog
2221
cz changelog
23-
```
2422

25-
```bash
23+
# or use the alias
2624
cz ch
27-
```
2825

29-
#### Get the changelog for the given version
30-
31-
```bash
26+
# Get the changelog for the given version
3227
cz changelog 0.3.0 --dry-run
33-
```
34-
35-
#### Get the changelog for the given version range
3628

37-
```bash
29+
# Get the changelog for the given version range
3830
cz changelog 0.3.0..0.4.0 --dry-run
3931
```
4032

4133
## Constrains
4234

43-
changelog generation is constrained only to **markdown** files.
35+
Changelog generation is constrained only to **markdown** files.
4436

4537
## Description
4638

@@ -73,51 +65,31 @@ and the following variables are expected:
7365

7466
- **required**: is the only one required to be parsed by the regex
7567

76-
## Configuration
77-
78-
### `unreleased_version`
79-
80-
There is usually a chicken and egg situation when automatically
81-
bumping the version and creating the changelog.
82-
If you bump the version first, you have no changelog, you have to
83-
create it later, and it won't be included in
84-
the release of the created version.
85-
86-
If you create the changelog before bumping the version, then you
87-
usually don't have the latest tag, and the _Unreleased_ title appears.
68+
## Command line options
8869

89-
By introducing `unreleased_version` you can prevent this situation.
70+
### `--extras`
9071

91-
Before bumping you can run:
72+
Provides your own changelog extra variables by using the `extras` settings or the `--extra/-e` parameter.
9273

9374
```bash
94-
cz changelog --unreleased-version="v1.0.0"
75+
cz changelog --extra key=value -e short="quoted value"
9576
```
9677

97-
Remember to use the tag instead of the raw version number
98-
99-
For example if the format of your tag includes a `v` (`v1.0.0`), then you should use that,
100-
if your tag is the same as the raw version, then ignore this.
101-
102-
Alternatively you can directly bump the version and create the changelog by doing
103-
104-
```bash
105-
cz bump --changelog
106-
```
78+
See [the template customization section](../customization.md#customizing-the-changelog-template)
10779

108-
### `file-name`
80+
### `--file-name`
10981

110-
This value can be updated in the `toml` file with the key `changelog_file` under `tools.commitizen`
82+
This value can be updated in the configuration file with the key `changelog_file` under `tools.commitizen`
11183

11284
Specify the name of the output file, remember that changelog only works with Markdown.
11385

11486
```bash
11587
cz changelog --file-name="CHANGES.md"
11688
```
11789

118-
### `incremental`
90+
### `--incremental`
11991

120-
This flag can be set in the `toml` file with the key `changelog_incremental` under `tools.commitizen`
92+
This flag can be set in the configuration file with the key `changelog_incremental` under `tools.commitizen`
12193

12294
Benefits:
12395

@@ -135,9 +107,9 @@ cz changelog --incremental
135107
changelog_incremental = true
136108
```
137109

138-
### `start-rev`
110+
### `--start-rev`
139111

140-
This value can be set in the `toml` file with the key `changelog_start_rev` under `tools.commitizen`
112+
This value can be set in the configuration file with the key `changelog_start_rev` under `tools.commitizen`
141113

142114
Start from a given git rev to generate the changelog. Commits before that rev will not be considered. This is especially useful for long-running projects adopting conventional commits, where old commit messages might fail to be parsed for changelog generation.
143115

@@ -151,9 +123,9 @@ cz changelog --start-rev="v0.2.0"
151123
changelog_start_rev = "v0.2.0"
152124
```
153125

154-
### merge-prerelease
126+
### `--merge-prerelease`
155127

156-
This flag can be set in the `toml` file with the key `changelog_merge_prerelease` under `tools.commitizen`
128+
This flag can be set in the configuration file with the key `changelog_merge_prerelease` under `tools.commitizen`
157129

158130
Collects changes from prereleases into the next non-prerelease. This means that if you have a prerelease version, and then a normal release, the changelog will show the prerelease changes as part of the changes of the normal release. If not set, it will include prereleases in the changelog.
159131

@@ -167,20 +139,40 @@ cz changelog --merge-prerelease
167139
changelog_merge_prerelease = true
168140
```
169141

170-
### `template`
142+
### `--template`
171143

172144
Provides your own changelog jinja template by using the `template` settings or the `--template` parameter.
173145
See [the template customization section](../customization.md#customizing-the-changelog-template)
174146

175-
### `extras`
147+
### `--unreleased-version`
176148

177-
Provides your own changelog extra variables by using the `extras` settings or the `--extra/-e` parameter.
149+
There is usually a chicken and egg situation when automatically
150+
bumping the version and creating the changelog.
151+
If you bump the version first, you have no changelog, you have to
152+
create it later, and it won't be included in
153+
the release of the created version.
154+
155+
If you create the changelog before bumping the version, then you
156+
usually don't have the latest tag, and the _Unreleased_ title appears.
157+
158+
By introducing `--unreleased-version` you can prevent this situation.
159+
160+
Before bumping you can run:
178161

179162
```bash
180-
cz changelog --extra key=value -e short="quoted value"
163+
cz changelog --unreleased-version="v1.0.0"
181164
```
182165

183-
See [the template customization section](../customization.md#customizing-the-changelog-template)
166+
Remember to use the tag instead of the raw version number
167+
168+
For example if the format of your tag includes a `v` (`v1.0.0`), then you should use that,
169+
if your tag is the same as the raw version, then ignore this.
170+
171+
Alternatively you can directly bump the version and create the changelog by doing
172+
173+
```bash
174+
cz bump --changelog
175+
```
184176

185177
## Hooks
186178

docs/config/changelog.md

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,8 @@
11
# Changelog Options
22

33
<!-- When adding a new option, please keep the alphabetical order. -->
4+
<!-- If there is a new configuration option that doesn't have a corresponding command line option, please add it here. -->
45

5-
## `changelog_file`
6+
As for now, each of the options that is used by `cz changelog` command can correlate to a command line option.
67

7-
- Type: `str`
8-
- Default: `CHANGELOG.md`
9-
10-
Filename of exported changelog
11-
12-
## `changelog_format`
13-
14-
- Type: `str`
15-
- Default: `None`
16-
17-
Format used to parse and generate the changelog. If not specified, resolved from [`changelog_file`](#changelog_file).
18-
19-
## `changelog_incremental`
20-
21-
- Type: `bool`
22-
- Default: `False`
23-
24-
Update changelog with the missing versions. This is good if you don't want to replace previous versions in the file.
25-
26-
!!! note
27-
When doing `cz bump --changelog`, this is automatically set to `True`.
28-
29-
## `changelog_merge_prerelease`
30-
31-
- Type: `bool`
32-
- Default: `False`
33-
34-
Collect all changes of prerelease versions into the next non-prerelease version when creating the changelog.
35-
36-
## `changelog_start_rev`
37-
38-
- Type: `str`
39-
- Default: `None`
40-
41-
Start from a given git rev to generate the changelog.
42-
43-
## `template`
44-
45-
- Type: `str`
46-
- Default: `None` (provided by plugin)
47-
48-
Provide custom changelog jinja template path relative to the current working directory. See [template customization](../customization.md#customizing-the-changelog-template) for more details.
49-
50-
## `extras`
51-
52-
- Type: `dict[str, Any]`
53-
- Default: `{}`
54-
55-
Provide extra variables to the changelog template. See [template customization](../customization.md#customizing-the-changelog-template) for more details.
8+
See [changelog command line options](../commands/changelog.md#command-line-options) for more details.

docs/customization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,6 @@ by:
524524
- defining them in your configuration with the [`extras` settings][extras-config]
525525
- providing them on the command line with the `--extra/-e` parameter to `bump` and `changelog` commands
526526

527-
[template-config]: config/changelog.md#template
528-
[extras-config]: config/changelog.md#extras
529-
[changelog-des]: ./commands/changelog.md#description
527+
[template-config]: commands/changelog.md#-template
528+
[extras-config]: commands/changelog.md#-extras
529+
[changelog-des]: commands/changelog.md#description

0 commit comments

Comments
 (0)