https://github.com/rustic-games/conventional-commit
A rust parser library for the Conventional Commit spec.
https://github.com/rustic-games/conventional-commit
Last synced: about 1 year ago
JSON representation
A rust parser library for the Conventional Commit spec.
- Host: GitHub
- URL: https://github.com/rustic-games/conventional-commit
- Owner: rustic-games
- Created: 2019-08-09T16:56:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-05T17:06:31.000Z (over 6 years ago)
- Last Synced: 2025-05-06T07:50:36.884Z (about 1 year ago)
- Language: Rust
- Homepage: https://www.conventionalcommits.org
- Size: 59.6 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
conventional::Commit
[](https://crates.io/crates/conventional "The latest released version on crates.io.")
[](https://docs.rs/conventional "The online documentation at docs.rs.")
[](https://discord.gg/Kc4qZWE "Ask a question or just enjoy your stay!")
A Rust parser library for the Conventional Commit spec.
### Quick Start
1. Add the crate to your `Cargo.toml`:
```shell
cargo install cargo-edit
cargo add conventional
```
2. Import the `Commit` type and the `Simple` trait to parse a commit string, and
query its different components as string slices:
```rust
use conventional::{Commit, Simple as _};
let commit = Commit::new("feat(conventional commit): this is it!").unwrap();
assert_eq!("feat", commit.type_());
assert_eq!("conventional commit", commit.scope());
assert_eq!("this is it!", commit.description());
assert_eq!(None, commit.body());
```
3. Upgrade to `Typed` components for strongly typed access:
```rust
use conventional::{Commit, Typed as _};
let commit = Commit::new("feat(conventional commit): this is it!").unwrap();
assert_eq!(Type("feat"), commit.type_());
```
4. Check out tools like [**Jilu**] for an example of library usage.
[latest specification]: https://www.conventionalcommits.org/en/v1.0.0-beta.4/#specification
[**Jilu**]: https://github.com/rustic-games/jilu