Crate keep_a_changelog_file

Source
Expand description

§Keep a Changelog File

Build Status MSRV

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.
ParseChangelogError
An error that occurred during changelog parsing.
ParseReleaseDateError
An error for release dates that cannot be parsed.
ParseReleaseLinkError
Error for when a release link cannot be parsed.
ParseVersionError
An error for when the version cannot be parsed into Semantic Versioning format.
PromoteOptions
Options for customizing the details of a promoted release.
PromoteUnreleasedError
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.
ReleaseDate
Release dates are in ISO 8601 date format (YYYY-MM-DD)
ReleaseLink
URI to the set of changes in a release.
ReleaseVersion
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 using promote_unreleased.

Enums§

ChangeGroup
Changes in a release are grouped into one of several types.
ReleaseTag
A release tag can be used to indicate: