1 个不稳定版本
0.1.0 | 2024年6月26日 |
---|
#1375 in 解析器实现
88 每月下载量
71KB
1.5K SLoC
保持变更日志文件
Keep a Changelog 格式的变更日志文件的序列化和反序列化器。
安装
cargo add keep_a_changelog_file
用法
use keep_a_changelog_file::{Changelog, ChangeGroup, PromoteOptions, ReleaseLink, ReleaseVersion};
fn example_usage() {
// 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 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}");
}
依赖
~7.5MB
~138K SLoC