|
|
@ -69,15 +69,18 @@ func supportGoStdFlag(args []string) []string {
|
|
|
|
flagValue = flagExpr[assignIndex:]
|
|
|
|
flagValue = flagExpr[assignIndex:]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
f := parentCmd.Flag(flagName)
|
|
|
|
if !isBuiltin(flagName) {
|
|
|
|
if f == nil {
|
|
|
|
// The method Flag can only match the user custom flags.
|
|
|
|
continue
|
|
|
|
f := parentCmd.Flag(flagName)
|
|
|
|
}
|
|
|
|
if f == nil {
|
|
|
|
if f.Shorthand == flagName {
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if f.Shorthand == flagName {
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
goStyleFlag := doubleDash + f.Name
|
|
|
|
goStyleFlag := doubleDash + flagName
|
|
|
|
if assignIndex > 0 {
|
|
|
|
if assignIndex > 0 {
|
|
|
|
goStyleFlag += flagValue
|
|
|
|
goStyleFlag += flagValue
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -87,8 +90,13 @@ func supportGoStdFlag(args []string) []string {
|
|
|
|
return copyArgs
|
|
|
|
return copyArgs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func isBuiltin(name string) bool {
|
|
|
|
|
|
|
|
return name == "version" || name == "help"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
rootCmd.Version = fmt.Sprintf("%s %s/%s", version.BuildVersion,
|
|
|
|
rootCmd.Version = fmt.Sprintf(
|
|
|
|
|
|
|
|
"%s %s/%s", version.BuildVersion,
|
|
|
|
runtime.GOOS, runtime.GOARCH)
|
|
|
|
runtime.GOOS, runtime.GOARCH)
|
|
|
|
rootCmd.AddCommand(api.Cmd)
|
|
|
|
rootCmd.AddCommand(api.Cmd)
|
|
|
|
rootCmd.AddCommand(bug.Cmd)
|
|
|
|
rootCmd.AddCommand(bug.Cmd)
|
|
|
|