()
| 28 | type GenCommand struct{} |
| 29 | |
| 30 | func (g *GenCommand) Command() *cli.Command { |
| 31 | var ( |
| 32 | name string |
| 33 | dir string |
| 34 | service string |
| 35 | ) |
| 36 | return &cli.Command{ |
| 37 | Name: "genCommand", |
| 38 | Usage: "Create a new command", |
| 39 | Flags: []cli.Flag{ |
| 40 | &cli.StringFlag{ |
| 41 | Name: "name", |
| 42 | Aliases: []string{"n"}, |
| 43 | Value: "", |
| 44 | Usage: "请输入命令工具名称 如:command", |
| 45 | Destination: &name, |
| 46 | Required: true, |
| 47 | }, |
| 48 | &cli.StringFlag{ |
| 49 | Name: "dir", |
| 50 | Aliases: []string{"d"}, |
| 51 | Value: "", |
| 52 | Usage: "请输入命令工具目录 如:test", |
| 53 | Destination: &dir, |
| 54 | Required: false, |
| 55 | }, |
| 56 | &cli.StringFlag{ |
| 57 | Name: "service", |
| 58 | Aliases: []string{"s"}, |
| 59 | Value: "", |
| 60 | Usage: "加载其他自定义服务(已经开启的服务) 如:mysql、redis ... 格式:以英文逗号相隔 如:mysql,redis", |
| 61 | Destination: &service, |
| 62 | Required: false, |
| 63 | }, |
| 64 | }, |
| 65 | Action: func(c *cli.Context) error { |
| 66 | return genCommand(name, dir, service) |
| 67 | }, |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | var _ command.Interface = (*GenCommand)(nil) |
| 72 |
nothing calls this directly
no test coverage detected