Usage¶
- clk¶
$ clk <options> <subcommand> ...
A helper for maintaining changelog files that use keep-a-changelog format.
Subcommands
Options
- -c, --config {<*.toml>|<*.yaml>|<*.yml>}¶
Override path to the config file.
By default, Changelog Keeper searches for
.cl-keeper.yaml,.cl-keeper.toml, orpyproject.tomlin the current directory or its parents.If
--inputis given, Changelog Keeper searches for config starting from the input file’s directory instead.If config can’t be found, Changelog Keeper will use the default config.
- -i, --input {-|<path>}¶
Override path to the changelog file. Pass
-to read file fromstdin.By default, Changelog Keeper searches for config, then searches for
CHANGELOG.mdrelative to the config file’s directory.If config can’t be found, Changelog Keeper searches for
CHANGELOG.mdin the current directory instead.
- --strict¶
Increase severity of all messages by one level.
- -m, --machine-readable-diagnostics¶
Print diagnostics in a machine readable format:
file:line:severity:code:message.
Global config overrides
- --cfg-*¶
See
config documentationfor details, or runclk --help=allto list all flags.
Misc options
- -h, --help¶
Print this message and exit.
- -V, --version¶
Print program version and exit.
- -v, --verbose...¶
Increase output verbosity.
- --bug-report¶
Print environment data for bug report and exit.
- --completions [<shell>]¶
Install or update autocompletion scripts and exit.
Supported shells:
all,uninstall,bash,zsh,fish, orpwsh.
- --color, --no-color¶
Enable or disable ANSI colors.
- Aliases:
--color={true|false|ansi|ansi-256|ansi-true}
- clk check¶
$ clk check <options>
Check contents of the changelog file.
- clk fix¶
$ clk fix <options> [--dry-run] [--diff]
Fix contents of the changelog file.
Options
- --diff¶
Print diff to
stdout.
- clk bump¶
$ clk bump <options> [--ignore-errors] [--dry-run] [--edit] <version> $ clk bump <options> [--ignore-errors] [--dry-run] [--edit] [auto|major|minor|patch|post] [--alpha|--beta|--rc]
Move entries from
unreleasedto a new release.First form moves entries from the
unreleasedsection to a new release for the specific version.Second form does the same, but the new version number is generated based on the last release.
Arguments
- <version>¶
Release version or tag that will be used for a new release. Can start with
tag_prefix, in which case the prefix is stripped.If
<version>ismajor,minor,patch, orpost, this command bumps the corresponding component of the latest version. In this case, the latest version is determined by comparing all releases (and tags, ifcheck_repo_tagsistrue) with respect to the chosenversion_format.If
<version>isauto, this command inspects contents of theunreleasedsection to determine which version component to bump:if there is a
breakingcategory, it creates a major release;if there are
added,changed, orremovedcategories, it creates a minor release;if there are
security,deprecated,performance, orfixedcategories, it creates a patch release;if none of the above categories are present, the command fails.
The list of categories for automatic bumping can be adjusted, see config options
bump_patch_categories,bump_minor_categories,bump_major_categories.
Options
- --alpha¶
Create an alpha pre-release.
This option is only allowed if
<version>isauto,major,minor,patch, orpost, or if<version>is not given at all. In the later case, the previous release should itself be a pre-release.
- --ignore-errors¶
Produce result even if errors are detected.
- --diff¶
Print diff to
stdout.
- --edit¶
Open generated changes for editing.
- --commit¶
Commit and tag the release after updating changelog.
Changelog Keeper will pause before committing and allow you to inspect repository or cancel the commit.
Examples
Specifying version manually
You can always supply a specific version for a new release. As long as there are no prior releases with the same version, this operation will succeed:
clk bump 1.0.5
Automatic version detection
Changelog keeper can suggest next version based on changelog content (the
--dry-runflag is handy here):clk bump auto
Bumping a version component
you can bump a version component by setting
<version>tomajor,minor,patch, orpost:clk bump minor # 1.0.0 -> 1.1.0
Pre-releases
You can make a pre-release by adding
--alpha,--beta, or--rc:clk bump major --beta # 1.5.1 -> 2.0.0b0
If the last release is a pre-release itself, you can bump its pre-release version component:
clk bump --beta # 1.0.0b0 -> 1.0.0b1 clk bump --rc # 1.0.0b0 -> 1.0.0rc0
- clk find¶
$ clk find <options> [--ignore-errors] [--json] <version> $ clk find <options> [--ignore-errors] [--json] unreleased $ clk find <options> [--ignore-errors] [--json] latest
Find a changelog entry for a given release version.
First form prints a changelog entry for the given release version.
Second form prints contents of the unreleased section.
Third form scans the changelog file and prints contents of the top-most non-
unreleasedentry. This form is intended for situations whenversion_formatisnone, i.e. there is no way to canonize version number.If errors detected in the changelog, the command fails unless
--ignore-errorswas given.If changelog entry isn’t found, the requested version is searched in the repo tags. If it’s found in the repo, and it satisfies config options
ignore_missing_releases_beforeorignore_missing_releases_regexp, an empty result is printed.Arguments
- <version>¶
Version that will be extracted from the changelog. Can start with
tag_prefix, in which case the prefix is stripped.
Options
- --ignore-errors¶
Produce result even if errors are detected.
- --json¶
Print data in JSON format.
- -o, --output {-|<path>}¶
Where to write results. Pass
-to write tostdout.- Default:
-
Examples
Find an exact version:
clk find v1.0.0-rc2
Find the first version (barring the
unreleasedsection) that appears in the changelog:clk find latest
Find the
unreleasedsection:clk find unreleased
Json output
If
--jsonflag is given, a JSON object is printed to stdout. It will contain the following fields:versionVersion string, as appears in the changelog.
Can be
nullif unreleased section is requested.canonizedVersionVersion string, canonized according to the used
version_format.If
version_formatisnullor canonization fails, this will contain string fromversion.tagTag that corresponds to this version.
Can be
nullif requested release not found, if unreleased section is requested, ifcheck_repo_tagsisfalse, if version canonization fails, or if tag is not found for this release.textText extracted from the changelog entry.
Can be empty if requested release not found.
isLatestInChangelogtrueif found version appears first in the changelog file.Can be
nullif requested release not found, or if unreleased section is requested.isLatestInSemanticOrdertrueif this is the latest known release.Release versions are compared with respect to the selected
version_format. Ifcheck_repo_tagsistrue, this flag also checks all tags found in the repository.Can be
nullif requested release not found, or if unreleased section is requested.isLatestEquals to
isLatestInSemanticOrderif it’s notnull, otherwise equals toisLatestInChangelog.isPreReleasetrueif release version contains a pre-release component, likebetaorrc.Can be
nullif requested release not found, if unreleased section is requested, or if version canonization fails.isPostReleasetrueif release version contains a post-release component.Can be
nullif requested release not found, if unreleased section is requested, or if version canonization fails.isUnreleasedtrueif unreleased section is requested.