test-errcode
wangchuxiao 2 years ago
parent a3aa965b37
commit 10cf431ccf

@ -12,7 +12,7 @@ func main() {
authCmd := cmd.NewAuthCmd() authCmd := cmd.NewAuthCmd()
authCmd.AddPortFlag() authCmd.AddPortFlag()
authCmd.AddPrometheusPortFlag() authCmd.AddPrometheusPortFlag()
if err := authCmd.Execute(); err != nil { if err := authCmd.Exec(); err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
os.Exit(1) os.Exit(1)
} }

@ -17,9 +17,10 @@ func NewAuthCmd() *AuthCmd {
} }
func (a *AuthCmd) Exec() error { func (a *AuthCmd) Exec() error {
a.Command.Run = func(cmd *cobra.Command, args []string) { a.Command.RunE = func(cmd *cobra.Command, args []string) error {
a.port = a.getPortFlag(cmd) a.port = a.getPortFlag(cmd)
a.prometheusPort = a.getPrometheusPortFlag(cmd) a.prometheusPort = a.getPrometheusPortFlag(cmd)
return a.getConfFromCmdAndInit(cmd)
} }
return a.Execute() return a.Execute()
} }

Loading…
Cancel
Save