Skip to content

Commit ec8bdb7

Browse files
feat(cmd): add Run
1 parent 386f1d7 commit ec8bdb7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cmd/cmd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ package cmd
33

44
import (
55
"fmt"
6+
"os"
67

78
"github.com/conventionalcommit/commitlint/config"
89
"github.com/urfave/cli/v2"
910
)
1011

12+
// Run is shorthand for New and calling cmd.Run with os.Args
13+
func Run() error {
14+
return New().Run(os.Args)
15+
}
16+
17+
// New returns commitlint cli.App
1118
func New() *cli.App {
1219
cmds := []*cli.Command{
1320
initCmd(),

main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import (
1010
var errExitCode = 1
1111

1212
func main() {
13-
app := cmd.New()
14-
err := app.Run(os.Args)
13+
err := cmd.Run()
1514
if err != nil {
1615
fmt.Println("Error:", err)
1716
os.Exit(errExitCode)

0 commit comments

Comments
 (0)