Skip to content

Commit 3789ced

Browse files
docs: update readme and license file
1 parent e96d730 commit 3789ced

2 files changed

Lines changed: 54 additions & 17 deletions

File tree

LICENSE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3+
Copyright (c) 2021 Muthu Krishnan
34
Copyright (c) 2021 Matthew Bamber
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,63 @@
1-
# Cov Commit Parser
2-
![CD](https://github.com/conventionalcommit/parser/workflows/CD/badge.svg)
1+
# Parser
32

4-
A simple parser for [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
3+
A simple go parser for [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
54

6-
## Usage
7-
When run without any arguments, `ccp version` will parse the commits at the current HEAD and output a single line containing a version number. This version number is the recommended version to use for the next build, based on the commit messages included since the latest tag on the branch.
5+
### Usage
86

9-
The current version number is determined by the tag representing the latest semantic version. This can be overridden using the `--current` flag.
7+
```go
8+
var msg = `feat(scope): description
109
11-
Use the `--since` flag to specify a commit hash, branch name or tag to adjust the commits used during the parsing.
10+
this is first line in body
1211
13-
### Use as a library
14-
The tool can also be embedded into existing Go programs. The example below returns a new version based on the starting version `1.0.0` and using the single commit on the `HEAD` of a git repository in the directory `repo_path`:
15-
```go
16-
commitMessages, err := git.GetCommitsInDirectory("repo_path", "HEAD~1", "HEAD")
17-
if err != nil {
18-
fmt.Printf("Error: %s", err.Error())
19-
}
12+
this is second line in body
13+
14+
Ref: #123
15+
Date: 01-01-2021
16+
By: John Doe`
2017

21-
v, err := ccp.GetNextVersion("1.0.0", commitMessages, ccp.DefaultPatchTypes)
18+
commit, err := Parse(msg)
2219
if err != nil {
2320
fmt.Printf("Error: %s", err.Error())
2421
}
22+
fmt.Printf("%#v", commit)
2523

26-
fmt.Println(v)
24+
/*
25+
commitMsg = &parser.Commit{
26+
Header: parser.Header{
27+
Type: "feat",
28+
Scope: "scope",
29+
Description: "description",
30+
FullHeader: "feat(scope): description",
31+
},
32+
Body: "this is first line in body\n\nthis is second line in body",
33+
Footer: parser.Footer{
34+
Notes: []parser.FooterNote{
35+
parser.FooterNote{
36+
Token: "Ref",
37+
Value: "#123",
38+
},
39+
parser.FooterNote{
40+
Token: "Date",
41+
Value: "01-01-2021",
42+
},
43+
parser.FooterNote{
44+
Token: "By",
45+
Value: "John Doe",
46+
},
47+
},
48+
FullFooter: "Ref: #123\nDate: 01-01-2021\nBy: John Doe",
49+
},
50+
BreakingChange: false,
51+
FullCommit: "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",
52+
}
53+
*/
2754
```
55+
56+
### Fork
57+
58+
This parser is a fork of [cov-commit-parser](github.com/mbamber/cov-commit-parser) by [Matthew Bamber](github.com/mbamber/)
59+
60+
### License
61+
62+
[MIT License](https://github.com/conventionalcommit/parser/tree/master/LICENSE.md)
63+

0 commit comments

Comments
 (0)