Skip to content

rustic-games/conventional-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conventional::Commit

Latest Crate Version Library Documentation Discord Chat


A Rust parser library for the Conventional Commit spec.

Quick Start

  1. Add the crate to your Cargo.toml:

    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:

    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:

    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.

About

A rust parser library for the Conventional Commit spec.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages