File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,6 @@ const (
1919 HookDir = ".commitlint/hooks"
2020)
2121
22- // VersionCallback is the version command callback
23- var VersionCallback = func () error {
24- fmt .Println ("commitlint" )
25- return nil
26- }
27-
2822func initCallback (ctx * cli.Context ) (retErr error ) {
2923 // get user home dir
3024 homeDir , err := os .UserHomeDir ()
Original file line number Diff line number Diff line change 22package cmd
33
44import (
5+ "fmt"
6+
57 "github.com/urfave/cli/v2"
68)
79
10+ var verTmpl = `commitlint version %s - built from %s on %s
11+ `
12+
813// New returns commitlint cli.App
9- func New () * cli.App {
14+ func New (versionNo , commitHash , builtTime string ) * cli.App {
1015 createCmd := & cli.Command {
1116 Name : "create" ,
1217 Usage : "create commitlint config, hooks files" ,
@@ -69,7 +74,8 @@ func New() *cli.App {
6974 Name : "version" ,
7075 Usage : "prints commitlint version" ,
7176 Action : func (c * cli.Context ) error {
72- return VersionCallback ()
77+ fmt .Printf (verTmpl , versionNo , commitHash , builtTime )
78+ return nil
7379 },
7480 }
7581
Original file line number Diff line number Diff line change 1515 BuildTime = ""
1616)
1717
18- var verTmpl = `commitlint %s-%s %s
19- `
20-
2118func main () {
22- cmd .VersionCallback = func () error {
23- fmt .Printf (verTmpl , Version , Commit , BuildTime )
24- return nil
25- }
26-
27- app := cmd .New ()
19+ app := cmd .New (Version , Commit , BuildTime )
2820 err := app .Run (os .Args )
2921 if err != nil {
3022 fmt .Println ("Error: " , err )
You can’t perform that action at this time.
0 commit comments