package main import ( "fmt" "github.com/spf13/cobra" ) func init() { } func main() { rootCmd := &cobra.Command{Use: "my cmd"} rootCmd.AddCommand(timeTask()) //rootCmd.AddCommand(bidding()) if err := rootCmd.Execute(); err != nil { fmt.Println("rootCmd.Execute failed", err.Error()) } } // @Description 供应商/经销商数据 // @Author J 2022/8/11 16:49 func timeTask() *cobra.Command { cmdClient := &cobra.Command{ Use: "time task", Short: "Start processing inc field data", Run: func(cmd *cobra.Command, args []string) { //task() }, } //cmdClient.Flags().StringVarP(&cfg, "conf", "c", "", "server config [toml]") return cmdClient }