Skip to content

Commit 22f5853

Browse files
feat: add version const, print version in report
1 parent a4ae772 commit 22f5853

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

cmd/commitlint/cmd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"fmt"
55

66
"github.com/urfave/cli/v2"
7+
8+
"github.com/conventionalcommit/commitlint"
79
)
810

911
func getApp() *cli.App {
@@ -55,7 +57,7 @@ func getApp() *cli.App {
5557
Name: "version",
5658
Usage: "prints commitlint version",
5759
Action: func(c *cli.Context) error {
58-
fmt.Println("commitlint - v0.1.0")
60+
fmt.Printf("commitlint - %s\n", commitlint.Version)
5961
return nil
6062
},
6163
}

template.qtpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
) -%}
66

77
{%- func errorMessage(cMsg *parser.Commit, res *Result) -%}
8-
commitlint
8+
commitlint - {%s Version %}
99

1010
→ input: {%q= cMsg.FullCommit %}
1111

template.qtpl.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

version.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package commitlint
2+
3+
// TODO: better version handling
4+
const Version = "v0.2.0"

0 commit comments

Comments
 (0)