Expand description
§Keep a Changelog File
A serializer and deserializer for changelog files written in Keep a Changelog format.
§Install
cargo add keep_a_changelog_file
§Usage
use keep_a_changelog_file::{Changelog, ChangeGroup, PromoteOptions, ReleaseLink, ReleaseVersion};
fn example_usage() {
// parse a changelog
let mut changelog: Changelog = "\
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [Unreleased]"
.parse()
.unwrap();
// modify the unreleased section
changelog
.unreleased
.add(ChangeGroup::Fixed, "Fixed bug in feature X");
changelog.unreleased.add(
ChangeGroup::Deprecated,
"Feature Y will be removed from the next major release",
);
// promote the unreleased changes to a new release
let release_version = "0.0.1".parse::<ReleaseVersion>().unwrap();
let release_link = "https://github.com/my-org/my-project/releases/v0.0.1"
.parse::<ReleaseLink>()
.unwrap();
changelog
.promote_unreleased(&PromoteOptions::new(release_version).with_link(release_link))
.unwrap();
// output the changelog
println!("{changelog}");
}
Structs§
- Changelog
- Represents a changelog written in Keep a Changelog format. The changelog is a curated, chronologically ordered list of notable changes for each version of a project.
- Changes
- Represents the changes that went into a release.
- Parse
Changelog Error - An error that occurred during changelog parsing.
- Parse
Release Date Error - An error for release dates that cannot be parsed.
- Parse
Release Link Error - Error for when a release link cannot be parsed.
- Parse
Version Error - An error for when the version cannot be parsed into Semantic Versioning format.
- Promote
Options - Options for customizing the details of a promoted release.
- Promote
Unreleased Error - Error when promoting unreleased to a version that already exists in the changelog.
- Release
- Represents release information such as the version, date, link to release, list of changes, and so on.
- Release
Date - Release dates are in ISO 8601 date format (YYYY-MM-DD)
- Release
Link - URI to the set of changes in a release.
- Release
Version - The version of a release in Semantic Versioning format.
- Releases
- The list of releases in the changelog.
- Unreleased
- Tracks upcoming changes. You can move the Unreleased changes into a new
Release
usingpromote_unreleased
.
Enums§
- Change
Group - Changes in a release are grouped into one of several types.
- Release
Tag - A release tag can be used to indicate: