Crate conventional_commit_parser[−][src]
Expand description
Conventional commit parser
A rust implementation of the conventional commit specification. This crate expose functions to parse conventional commit messages.
Example :
use conventional_commit_parser::parse;
use conventional_commit_parser::commit::*;
let message = r#"fix: correct minor typos in code
see the issue for details
on typos fixed.
Reviewed-by: Z
Refs #133"#;
let commit = parse(message)?;
assert_eq!(commit.commit_type, CommitType::BugFix);
assert_eq!(commit.summary, "correct minor typos in code");
assert_eq!(commit.body, Some(r#"see the issue for details
on typos fixed."#));
assert_eq!(commit.footers, vec![
Footer {token: "Reviewed-by", content: "Z"},
Footer {token: "Refs", content: "133",}
]);
Modules
Enums
Functions
Parse a commit message into a commit::ConventionalCommit
Parse a commit body only returning an Option<String>
on a non empty trimmed value
Parse commit footers only
Parse a commit summary of the following form : <type>[optional scope]: <description>
Returns a ConventionalCommit
struct with a None
body and empty footers.