feat: Replace cli to cobra (#1855)

* Replace cli

* Replace cli

* Replace cli

* Format code

* Add compare case

* Add compare case

* Add compare case

* Support go style flag

* Support go style flag

* Add test case
This commit is contained in:
anqiansong
2022-05-07 15:40:11 +08:00
committed by GitHub
parent 51472004a3
commit 5383e29ce6
61 changed files with 1858 additions and 1590 deletions

View File

@@ -5,7 +5,7 @@ import (
"strings"
"time"
"github.com/urfave/cli"
"github.com/spf13/cobra"
"github.com/zeromicro/go-zero/tools/goctl/pkg/env"
"github.com/zeromicro/go-zero/tools/goctl/pkg/protoc"
"github.com/zeromicro/go-zero/tools/goctl/pkg/protocgengo"
@@ -37,11 +37,8 @@ var bins = []bin{
},
}
func Check(ctx *cli.Context) error {
install := ctx.Bool("install")
force := ctx.Bool("force")
verbose := ctx.Bool("verbose")
return Prepare(install, force, verbose)
func check(_ *cobra.Command, _ []string) error {
return Prepare(boolVarInstall, boolVarForce, boolVarVerbose)
}
func Prepare(install, force, verbose bool) error {