Skip to content

heroku/keep_a_changelog

Keep a Changelog Serializer/Deserializer

Build Status Docs Latest Version MSRV

A serializer and deserializer for changelogs written in Keep a Changelog format.

Install

cargo add keep_a_changelog

Usage

use keep_a_changelog::{Changelog, ChangeGroup, PromoteOptions};

fn main() {
    // parse a changelog
    let mut changelog: 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 promote_options = PromoteOptions::new("0.0.1".parse().unwrap())
        .with_link("https://github.com/my-org/my-project/releases/v0.0.1".parse().unwrap());
    changelog.promote_unreleased(&promote_options).unwrap();

    // output the changelog
    println!("{}", changelog);
}

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages