Command ...
()
| 27 | |
| 28 | // Command ... |
| 29 | func (g *GenController) Command() *cli.Command { |
| 30 | var ( |
| 31 | name string |
| 32 | dir string |
| 33 | ) |
| 34 | return &cli.Command{ |
| 35 | Name: "genController", |
| 36 | Usage: "Create a new controller", |
| 37 | Flags: []cli.Flag{ |
| 38 | &cli.StringFlag{ |
| 39 | Name: "name", |
| 40 | Aliases: []string{"n"}, |
| 41 | Value: "", |
| 42 | Usage: "请输入controller名称 如:user", |
| 43 | Destination: &name, |
| 44 | Required: true, |
| 45 | }, |
| 46 | &cli.StringFlag{ |
| 47 | Name: "dir", |
| 48 | Aliases: []string{"d"}, |
| 49 | Value: "", |
| 50 | Usage: "请输入controller目录 如:backend or backend/user", |
| 51 | Destination: &dir, |
| 52 | Required: false, |
| 53 | }, |
| 54 | }, |
| 55 | Before: func(ctx *cli.Context) error { |
| 56 | return boots.InitConfig() |
| 57 | }, |
| 58 | Action: func(ctx *cli.Context) error { |
| 59 | return handleGenController(name, dir) |
| 60 | }, |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | var _ command.Interface = (*GenController)(nil) |
| 65 |
nothing calls this directly
no test coverage detected