Skip to content

Commit 7153a46

Browse files
refactor(cmd)!: unexport cmd call back functions
1 parent 79edbb8 commit 7153a46

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

cmd/callback.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ const (
1414
ErrExitCode = 1
1515
)
1616

17-
// Init is the callback function for init command
18-
func Init(confPath string, isGlobal, isReplace bool) error {
17+
// initLint is the callback function for init command
18+
func initLint(confPath string, isGlobal, isReplace bool) error {
1919
hookDir, err := initHooks(confPath, isGlobal, isReplace)
2020
if err != nil {
2121
return err
2222
}
2323
return setGitConf(hookDir, isGlobal)
2424
}
2525

26-
// Lint is the callback function for lint command
27-
func Lint(confPath, msgPath string) error {
26+
// lintMsg is the callback function for lint command
27+
func lintMsg(confPath, msgPath string) error {
2828
// NOTE: lint should return with exit code for error case
2929
resStr, hasError, err := runLint(confPath, msgPath)
3030
if err != nil {
@@ -40,20 +40,20 @@ func Lint(confPath, msgPath string) error {
4040
return nil
4141
}
4242

43-
// HookCreate is the callback function for create hook command
44-
func HookCreate(confPath string, isReplace bool) error {
43+
// hookCreate is the callback function for create hook command
44+
func hookCreate(confPath string, isReplace bool) error {
4545
return createHooks(confPath, isReplace)
4646
}
4747

48-
// ConfigCreate is the callback function for create config command
49-
func ConfigCreate(onlyEnabled bool) error {
48+
// configCreate is the callback function for create config command
49+
func configCreate(onlyEnabled bool) error {
5050
defConf := config.GetDefaultConf(onlyEnabled)
5151
outPath := filepath.Join(".", config.DefaultFile)
5252
return config.WriteConfToFile(outPath, defConf)
5353
}
5454

55-
// ConfigCheck is the callback function for check/verify command
56-
func ConfigCheck(confPath string) error {
55+
// configCheck is the callback function for check/verify command
56+
func configCheck(confPath string) error {
5757
conf, err := config.Parse(confPath)
5858
if err != nil {
5959
return err

cmd/cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func lintCmd() *cli.Command {
5353
Action: func(ctx *cli.Context) error {
5454
confFilePath := ctx.String("config")
5555
fileInput := ctx.String("message")
56-
return Lint(confFilePath, fileInput)
56+
return lintMsg(confFilePath, fileInput)
5757
},
5858
}
5959
}
@@ -77,7 +77,7 @@ func initCmd() *cli.Command {
7777
isGlobal := ctx.Bool("global")
7878
isReplace := ctx.Bool("replace")
7979

80-
err := Init(confPath, isGlobal, isReplace)
80+
err := initLint(confPath, isGlobal, isReplace)
8181
if err != nil {
8282
if isHookExists(err) {
8383
fmt.Println("commitlint init failed")
@@ -107,7 +107,7 @@ func configCmd() *cli.Command {
107107
},
108108
Action: func(ctx *cli.Context) error {
109109
isOnlyEnabled := ctx.Bool("enabled")
110-
return ConfigCreate(isOnlyEnabled)
110+
return configCreate(isOnlyEnabled)
111111
},
112112
}
113113

@@ -124,7 +124,7 @@ func configCmd() *cli.Command {
124124
},
125125
Action: func(ctx *cli.Context) error {
126126
confFile := ctx.String("config")
127-
err := ConfigCheck(confFile)
127+
err := configCheck(confFile)
128128
if err != nil {
129129
return err
130130
}
@@ -151,7 +151,7 @@ func hookCmd() *cli.Command {
151151
Action: func(ctx *cli.Context) error {
152152
confPath := ctx.String("config")
153153
isReplace := ctx.Bool("replace")
154-
err := HookCreate(confPath, isReplace)
154+
err := hookCreate(confPath, isReplace)
155155
if err != nil {
156156
if isHookExists(err) {
157157
fmt.Println("create failed. hook files already exists")

0 commit comments

Comments
 (0)