conventionalcommit / parser

A go parser for Conventional Commits message

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parser

A go parser for Conventional Commits messages

PkgGoDevGitHub go.mod Go version

Usage

var msg = `feat(scope): description

this is first line in body

this is second line in body

Ref #123
Date: 01-01-2021
By: John Doe`

commit, err := Parse(msg)
if err != nil {
    fmt.Printf("Error: %s", err.Error())
}
fmt.Printf("%#v", commit)

/*
commitMsg = &parser.Commit{
    message:     "feat(scope): description\n\nthis is first line in body\n\nthis is second line in body\n\nRef #123\nDate: 01-01-2021\nBy: John Doe",
    header:      "feat(scope): description",
    body:        "this is first line in body\n\nthis is second line in body",
    footer:      "Ref #123\nDate: 01-01-2021\nBy: John Doe",
    commitType:  "feat",
    scope:       "scope",
    description: "description",
    notes:       {
        {token:"Ref", value:"123"},
        {token:"Date", value:"01-01-2021"},
        {token:"By", value:"John Doe"},
    },
    isBreakingChange: false,
}
*/

TODO

  • More Test Cases
  • Benchmark

Attribution

This parser is inspired and forked from

License

MIT License

About

A go parser for Conventional Commits message

License:MIT License


Languages

Language:Go 100.0%