Skip to content

Commit bc6df9e

Browse files
committed
style(cmd): rename the cmd name of install,version
before: NewInstallCmd, NewVersionCmd after: newCmdInstall, newCmdVersion
1 parent 25f6976 commit bc6df9e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

cmd/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @Author: robert zhang <robertzhangwenjie@gmail.com>
33
* @Date: 2022-08-07 11:04:45
4-
* @LastEditTime: 2022-08-08 11:46:01
4+
* @LastEditTime: 2022-08-23 15:03:12
55
* @LastEditors: robert zhang
66
* @Description:
77
*/
@@ -15,7 +15,7 @@ import (
1515
"github.com/spf13/cobra"
1616
)
1717

18-
func NewInstallCmd() *cobra.Command {
18+
func newCmdInstall() *cobra.Command {
1919
cmd := &cobra.Command{
2020
Use: "install",
2121
Short: "install git-cz command",

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func NewRootCmd(name string) *cobra.Command {
2323
SilenceErrors: true,
2424
SilenceUsage: true,
2525
}
26-
cmd.AddCommand(NewInstallCmd(), NewVersionCmd())
26+
cmd.AddCommand(newCmdInstall(), newCmdVersion())
2727
cmd.Flags().BoolVar(&dryRun, "dry-run", dryRun, "preview result")
2828
return cmd
2929
}

cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @Author: robert zhang <robertzhangwenjie@gmail.com>
33
* @Date: 2022-08-22 10:09:33
4-
* @LastEditTime: 2022-08-22 10:24:34
4+
* @LastEditTime: 2022-08-23 15:03:44
55
* @LastEditors: robert zhang
66
* @Description:
77
*/
@@ -14,7 +14,7 @@ import (
1414
"github.com/spf13/cobra"
1515
)
1616

17-
func NewVersionCmd() *cobra.Command {
17+
func newCmdVersion() *cobra.Command {
1818
cmd := &cobra.Command{
1919
Use: "version",
2020
Short: "print tool version",

pkg/version/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @Author: robert zhang <robertzhangwenjie@gmail.com>
33
* @Date: 2022-08-22 10:02:39
4-
* @LastEditTime: 2022-08-22 10:27:28
4+
* @LastEditTime: 2022-08-22 10:53:08
55
* @LastEditors: robert zhang
66
* @Description:
77
*/
@@ -29,7 +29,7 @@ var (
2929

3030
// Info contains versioning information.
3131
type Info struct {
32-
GitVersion string `json:"GitVersion"`
32+
GitVersion string `json:"GitVersion,omitempty"`
3333
GitCommit string `json:"GitCommit"`
3434
GitTreeState string `json:"GitTreeState"`
3535
BuildTime string `json:"BuildDate"`

0 commit comments

Comments
 (0)