Skip to content

Commit f059ae5

Browse files
refactor(cmd)!: remove conf flag alias, rename internal funcs
1 parent 963d7f8 commit f059ae5

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

internal/cmd/cli.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import (
99
"github.com/conventionalcommit/commitlint/internal"
1010
)
1111

12-
// newCmd returns commitlint cli.App
13-
func newCmd() *cli.App {
12+
// newCliApp returns commitlint cli.App
13+
func newCliApp() *cli.App {
1414
cmds := []*cli.Command{
15-
initCmd(),
16-
lintCmd(),
17-
configCmd(),
18-
hookCmd(),
19-
debugCmd(),
15+
newInitCmd(),
16+
newLintCmd(),
17+
newConfigCmd(),
18+
newHookCmd(),
19+
newDebugCmd(),
2020
}
2121

2222
app := &cli.App{
@@ -28,14 +28,14 @@ func newCmd() *cli.App {
2828
return app
2929
}
3030

31-
func lintCmd() *cli.Command {
31+
func newLintCmd() *cli.Command {
3232
return &cli.Command{
3333
Name: "lint",
3434
Usage: "Check commit message against lint rules",
3535
Flags: []cli.Flag{
3636
&cli.StringFlag{
3737
Name: "config",
38-
Aliases: []string{"c", "conf"},
38+
Aliases: []string{"c"},
3939
Value: "",
4040
Usage: "optional config file `conf.yaml`",
4141
},
@@ -54,9 +54,9 @@ func lintCmd() *cli.Command {
5454
}
5555
}
5656

57-
func initCmd() *cli.Command {
58-
confFlag := formConfFlag()
59-
replaceFlag := formReplaceFlag()
57+
func newInitCmd() *cli.Command {
58+
confFlag := newConfFlag()
59+
replaceFlag := newReplaceFlag()
6060

6161
globalFlag := &cli.BoolFlag{
6262
Name: "global",
@@ -89,7 +89,7 @@ func initCmd() *cli.Command {
8989
}
9090
}
9191

92-
func configCmd() *cli.Command {
92+
func newConfigCmd() *cli.Command {
9393
createCmd := &cli.Command{
9494
Name: "create",
9595
Usage: "Creates default config in current directory",
@@ -129,7 +129,7 @@ func configCmd() *cli.Command {
129129
Flags: []cli.Flag{
130130
&cli.StringFlag{
131131
Name: "config",
132-
Aliases: []string{"c", "conf"},
132+
Aliases: []string{"c"},
133133
Usage: "config file `conf.yaml`",
134134
Required: true,
135135
},
@@ -156,8 +156,8 @@ func configCmd() *cli.Command {
156156
}
157157
}
158158

159-
func hookCmd() *cli.Command {
160-
replaceFlag := formReplaceFlag()
159+
func newHookCmd() *cli.Command {
160+
replaceFlag := newReplaceFlag()
161161

162162
createCmd := &cli.Command{
163163
Name: "create",
@@ -186,7 +186,7 @@ func hookCmd() *cli.Command {
186186
}
187187
}
188188

189-
func debugCmd() *cli.Command {
189+
func newDebugCmd() *cli.Command {
190190
return &cli.Command{
191191
Name: "debug",
192192
Usage: "prints usable information for debugging",
@@ -196,16 +196,16 @@ func debugCmd() *cli.Command {
196196
}
197197
}
198198

199-
func formConfFlag() *cli.StringFlag {
199+
func newConfFlag() *cli.StringFlag {
200200
return &cli.StringFlag{
201201
Name: "config",
202-
Aliases: []string{"c", "conf"},
202+
Aliases: []string{"c"},
203203
Value: "",
204204
Usage: "Optional config file `conf.yaml` which will be passed to 'commitlint lint'. Check config precedence",
205205
}
206206
}
207207

208-
func formReplaceFlag() *cli.BoolFlag {
208+
func newReplaceFlag() *cli.BoolFlag {
209209
return &cli.BoolFlag{
210210
Name: "replace",
211211
Usage: "Replace hook files if already exists",

internal/cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
// Run runs commitlint cli with os.Args
99
func Run() error {
10-
return newCmd().Run(os.Args)
10+
return newCliApp().Run(os.Args)
1111
}
1212

1313
type multiError []error

0 commit comments

Comments
 (0)