gitee.com/quant1x/engine@v1.8.4/command/command_rules.go (about) 1 package command 2 3 import ( 4 "gitee.com/quant1x/engine/rules" 5 cmder "github.com/spf13/cobra" 6 ) 7 8 // CmdRules 规则 9 var CmdRules = &cmder.Command{ 10 Use: "rules", 11 Short: "规则", 12 Args: func(cmd *cmder.Command, args []string) error { 13 return nil 14 }, 15 //ValidArgsFunction: func(cmd *cmder.Command, args []string, toComplete string) ([]string, cmder.ShellCompDirective) { 16 // 17 //}, 18 PreRun: func(cmd *cmder.Command, args []string) { 19 20 }, 21 Run: func(cmd *cmder.Command, args []string) { 22 rules.PrintRuleList() 23 }, 24 } 25 26 func initRules() { 27 //CmdRules.SetFlagErrorFunc(func(cmd *cmder.Command, err error) error { 28 // args := os.Args[1:] 29 // cmd_, flags, err := cmd.Parent().Find(args) 30 // fmt.Println(cmd_, flags, err) 31 // return nil 32 //}) 33 }