Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CMD = func() *cli.Command { // 项目名 var name string return &cli.Command{ Name: "init", Usage: "init a project.", Action: func(ctx *cli.Context) error { if name == "" { return errors.New("must a name") } if err := conf.WriteConf(conf.Conf{ ModName: name, }); err != nil { return err } for _, dir := range dirs { if err := os.MkdirAll(dir, os.ModePerm); err != nil { return err } } if err := os.MkdirAll(filepath.Join("internal", "pb", "proto"), os.ModePerm); err != nil { return err } gitignFile, err := os.Create(".gitignore") if err != nil { return err } defer gitignFile.Close() if _, err := gitignFile.WriteString(gitignoreText); err != nil { return err } gomodCmd := exec.Command("go", "mod", "init", name) _, err = gomodCmd.Output() if err != nil { return err } return nil }, Flags: []cli.Flag{ &cli.StringFlag{ Name: "name", Usage: "project name", Destination: &name, }, }, } }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.