Skip to content

Commit

Permalink
Update readme (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
runesoerensen authored Jun 25, 2024
1 parent f92ec48 commit f1e1e1b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ missing_docs = "warn"

[lints.clippy]
panic_in_result_fn = "warn"
pedantic = "warn"
# The explicit priority is required due to https://github.com/rust-lang/cargo/issues/13565.
pedantic = { level = "warn", priority = -1 }
unwrap_used = "warn"
enum_variant_names = "allow"
missing_errors_doc = "allow"
Expand Down
60 changes: 27 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Keep a Changelog Serializer/Deserializer

[![Build Status]][ci] [![Docs]][docs.rs] [![Latest Version]][crates.io] [![MSRV]][install-rust]

[Build Status]: https://img.shields.io/github/actions/workflow/status/colincasey/keep_a_changelog/ci.yml?branch=main
[ci]: https://github.com/colincasey/keep_a_changelog/actions/workflows/ci.yml?query=branch%3Amain
[Docs]: https://img.shields.io/docsrs/keep_a_changelog
[docs.rs]: https://docs.rs/keep_a_changelog/latest/keep_a_changelog/
[Latest Version]: https://img.shields.io/crates/v/keep_a_changelog.svg
[crates.io]: https://crates.io/crates/keep_a_changelog
[![Build Status]][ci] [![MSRV]][install-rust]

[Build Status]: https://img.shields.io/github/actions/workflow/status/heroku/keep_a_changelog/ci.yml?branch=main
[ci]: https://github.com/heroku/keep_a_changelog/actions/workflows/ci.yml?query=branch%3Amain
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install

Expand All @@ -16,17 +12,16 @@ A serializer and deserializer for changelogs written in [Keep a Changelog](https
## Install

```sh
cargo add keep_a_changelog
cargo add --git https://github.com/heroku/keep_a_changelog
```

## Usage

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

fn main() {
// parse a changelog
let mut changelog: Changelog = "\
// parse a changelog
let mut changelog: Changelog = "\
# Changelog
All notable changes to this project will be documented in this file.
Expand All @@ -35,25 +30,24 @@ 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);
}
.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);
```

0 comments on commit f1e1e1b

Please sign in to comment.