feat: remove command version
parent
74295440d5
commit
e3cf61cb10
|
@ -13,7 +13,6 @@ Tool to generate `CHANGELOG.md`, `CHANGELOG.rst` from [Conventional Commits](htt
|
||||||
- [x] Interactive mode
|
- [x] Interactive mode
|
||||||
- [ ] Unit test
|
- [ ] Unit test
|
||||||
- [ ] Auto generate commit after gen CHANGELOG
|
- [ ] Auto generate commit after gen CHANGELOG
|
||||||
- [x] Add version command
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|
1
go.mod
1
go.mod
|
@ -5,7 +5,6 @@ go 1.18
|
||||||
require (
|
require (
|
||||||
github.com/go-git/go-git/v5 v5.4.2
|
github.com/go-git/go-git/v5 v5.4.2
|
||||||
github.com/haunt98/clock-go v0.3.0
|
github.com/haunt98/clock-go v0.3.0
|
||||||
github.com/make-go-great/buildinfo-go v0.0.4
|
|
||||||
github.com/make-go-great/color-go v0.3.0
|
github.com/make-go-great/color-go v0.3.0
|
||||||
github.com/make-go-great/ioe-go v0.4.0
|
github.com/make-go-great/ioe-go v0.4.0
|
||||||
github.com/make-go-great/markdown-go v0.5.0
|
github.com/make-go-great/markdown-go v0.5.0
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -56,8 +56,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/make-go-great/buildinfo-go v0.0.4 h1:0n5GZzVh45pJoWVRL/JRkxXAOyDwBV92b5EjtVINIko=
|
|
||||||
github.com/make-go-great/buildinfo-go v0.0.4/go.mod h1:neEb4WWRyUmzQvlMqvrjiDexkS+QXZMq2B5yXLe4GS8=
|
|
||||||
github.com/make-go-great/color-go v0.3.0 h1:ZVtVk/wVVsZZwSJG7PZpsY5zwIyGao5VoN48yKfSzYA=
|
github.com/make-go-great/color-go v0.3.0 h1:ZVtVk/wVVsZZwSJG7PZpsY5zwIyGao5VoN48yKfSzYA=
|
||||||
github.com/make-go-great/color-go v0.3.0/go.mod h1:G5G8IJ3PUo+vSQ+UvnfaswF8O/piVIhFJKv1mQjBGpI=
|
github.com/make-go-great/color-go v0.3.0/go.mod h1:G5G8IJ3PUo+vSQ+UvnfaswF8O/piVIhFJKv1mQjBGpI=
|
||||||
github.com/make-go-great/ioe-go v0.4.0 h1:abRH8J01am7A9VsinEG0WnXDiT1CWk7Cd0auRvWuNyQ=
|
github.com/make-go-great/ioe-go v0.4.0 h1:abRH8J01am7A9VsinEG0WnXDiT1CWk7Cd0auRvWuNyQ=
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/make-go-great/buildinfo-go"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,21 +33,6 @@ type action struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *action) RunVersion(c *cli.Context) error {
|
|
||||||
info, ok := buildinfo.Read()
|
|
||||||
if !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if info.GitCommit != "" {
|
|
||||||
fmt.Printf("%s-%s\n", info.MainModuleVersion, info.GitCommit)
|
|
||||||
} else {
|
|
||||||
fmt.Println(info.MainModuleVersion)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *action) RunHelp(c *cli.Context) error {
|
func (a *action) RunHelp(c *cli.Context) error {
|
||||||
return cli.ShowAppHelp(c)
|
return cli.ShowAppHelp(c)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,8 @@ const (
|
||||||
flagInteractive = "interactive"
|
flagInteractive = "interactive"
|
||||||
|
|
||||||
commandGenerate = "generate"
|
commandGenerate = "generate"
|
||||||
commandVersion = "version"
|
|
||||||
|
|
||||||
usageGenerate = "generate changelog"
|
usageGenerate = "generate changelog"
|
||||||
usageCommandVersion = "git commit when build changeloguru"
|
|
||||||
usageVerbose = "show what is going on"
|
usageVerbose = "show what is going on"
|
||||||
usageFlagVersion = "`VERSION` to generate, follow Semantic Versioning"
|
usageFlagVersion = "`VERSION` to generate, follow Semantic Versioning"
|
||||||
usageFrom = "from `COMMIT`, which is kinda new commit, default is latest commit"
|
usageFrom = "from `COMMIT`, which is kinda new commit, default is latest commit"
|
||||||
|
@ -117,11 +115,6 @@ func NewApp() *App {
|
||||||
},
|
},
|
||||||
Action: a.RunGenerate,
|
Action: a.RunGenerate,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: commandVersion,
|
|
||||||
Usage: usageCommandVersion,
|
|
||||||
Action: a.RunVersion,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Action: a.RunHelp,
|
Action: a.RunHelp,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue