[][src]Crate conventional

A parser library for the Conventional Commit specification.

Example

use conventional::{Commit, Error, Simple as _};
use std::str::FromStr;

fn main() -> Result<(), Error> {
    let message = "\
    docs(example): add tested usage example

    This example is tested using Rust's doctest capabilities. Having this
    example helps people understand how to use the parser.

    BREAKING CHANGE: Going from nothing to something, meaning anyone doing
    nothing before suddenly has something to do. That sounds like a change
    in your break.
    ";

    let commit = Commit::new(message)?;

    assert_eq!(commit.type_(), "docs");
    assert_eq!(commit.scope(), Some("example"));
    assert_eq!(commit.description(), "add tested usage example");
    assert!(commit.body().unwrap().contains("helps people understand"));
    assert!(commit.breaking_change().unwrap().contains("That sounds like a change"));
}

Re-exports

pub use commit::simple::Simple;
pub use commit::typed::Typed;
pub use commit::Commit;
pub use component::Body;
pub use component::BreakingChange;
pub use component::Description;
pub use component::Scope;
pub use component::Type;
pub use error::Error;
pub use error::Kind as ErrorKind;

Modules

commit

The conventional commit type and its simple, and typed implementations.

component

Conventional Commit components.

error

All errors related to Conventional Commits.