Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CMD = func() *cli.Command { var name string // 名称 var addr string // 监听地址 var instanceID int return &cli.Command{ Name: "http", Usage: "create a http api", Action: func(ctx *cli.Context) error { if name == "" { return errors.New("must a name") } if err := os.MkdirAll(filepath.Join("internal", "api", name), os.ModePerm); err != nil { return err } if err := createMainFile(name, addr, instanceID); err != nil { return err } if err := createConfigYaml(name); err != nil { return err } gomodCmd := exec.Command("go", "mod", "tidy") _, err := gomodCmd.Output() if err != nil { return err } return nil }, Flags: []cli.Flag{ &cli.StringFlag{ Name: "name, n", Usage: "http api name", Destination: &name, }, &cli.StringFlag{ Name: "addr, a", Usage: "http api listen address", Destination: &addr, Value: "127.0.0.1:8080", }, &cli.IntFlag{ Name: "id, i", Usage: "http api intance id", Destination: &instanceID, Value: 1, }, }, } }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.