fix: replace goctl ExactValidArgs to MatchAll (#2759)
Co-authored-by: chenjieping <chenjieping@kezaihui.com>
This commit is contained in:
@@ -51,7 +51,7 @@ var (
|
|||||||
Use: "new",
|
Use: "new",
|
||||||
Short: "Fast create api service",
|
Short: "Fast create api service",
|
||||||
Example: "goctl api new [options] service-name",
|
Example: "goctl api new [options] service-name",
|
||||||
Args: cobra.ExactValidArgs(1),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return new.CreateServiceCommand(args)
|
return new.CreateServiceCommand(args)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "compare",
|
Use: "compare",
|
||||||
Short: "Compare the goctl commands generated results between urfave and cobra",
|
Short: "Compare the goctl commands generated results between urfave and cobra",
|
||||||
Args: cobra.ExactValidArgs(1),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
dir := args[0]
|
dir := args[0]
|
||||||
testdata.MustRun(dir)
|
testdata.MustRun(dir)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ var (
|
|||||||
newCmd = &cobra.Command{
|
newCmd = &cobra.Command{
|
||||||
Use: "new",
|
Use: "new",
|
||||||
Short: "Generate rpc demo service",
|
Short: "Generate rpc demo service",
|
||||||
Args: cobra.ExactValidArgs(1),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
RunE: cli.RPCNew,
|
RunE: cli.RPCNew,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ var (
|
|||||||
Use: "protoc",
|
Use: "protoc",
|
||||||
Short: "Generate grpc code",
|
Short: "Generate grpc code",
|
||||||
Example: "goctl rpc protoc xx.proto --go_out=./pb --go-grpc_out=./pb --zrpc_out=.",
|
Example: "goctl rpc protoc xx.proto --go_out=./pb --go-grpc_out=./pb --zrpc_out=.",
|
||||||
Args: cobra.ExactValidArgs(1),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
RunE: cli.ZRPC,
|
RunE: cli.ZRPC,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user