Crates.io | conventional |
lib.rs | conventional |
version | 0.5.0 |
source | src |
created_at | 2019-08-15 19:49:06.31995 |
updated_at | 2019-11-22 16:20:33.104372 |
description | A parser library for the Conventional Commit specification. |
homepage | |
repository | https://github.com/rustic-games/conventional-commit |
max_upload_size | |
id | 157152 |
size | 37,681 |
Add the crate to your Cargo.toml
:
cargo install cargo-edit
cargo add conventional
Import the Commit
type and the Simple
trait to parse a commit string, and
query its different components as string slices:
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());
Upgrade to Typed
components for strongly typed access:
use conventional::{Commit, Typed as _};
let commit = Commit::new("feat(conventional commit): this is it!").unwrap();
assert_eq!(Type("feat"), commit.type_());
Check out tools like Jilu for an example of library usage.