Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdAdd = &cobra.Command{
Use: "add",
Short: "Add proto, dockerfile or makefile",
Long: "Add proto, dockerfile or makefile",
}
View Source
var CmdAddApi = &cobra.Command{ Use: "api", Short: "Add proto api file", Long: "Add proto api file", Example: "mangokit add api api/helloworld/v1/proto hello.proto", Run: func(cmd *cobra.Command, args []string) { dir, name := cmdFunc(args) GenerateProtoFile(dir, name, ProtoApiContent) }, }
View Source
var CmdAddDockerfile = &cobra.Command{ Use: "dockerfile", Short: "Generate dockerfile", Long: "Generate dockerfile", Run: func(cmd *cobra.Command, args []string) { _, err := os.Stat("Dockerfile") if err == nil { color.Yellow("Dockerfile is already exist!\n") return } if err = os.WriteFile("Dockerfile", []byte(dockerfileContent), 0666); err != nil { color.Red("generate Dockerfile error, %v\n", err) return } color.Green("Dockerfile added!") }, }
View Source
var CmdAddError = &cobra.Command{ Use: "error", Short: "Add proto error file", Long: "Add proto error file", Example: "mangokit add api api/helloworld/v1/proto errReason.proto", Run: func(cmd *cobra.Command, args []string) { dir, name := cmdFunc(args) GenerateProtoFile(dir, name, ProtoErrorContent) }, }
View Source
var CmdAddMakefile = &cobra.Command{ Use: "makefile", Short: "Generate makefile", Long: "Generate makefile", Run: func(cmd *cobra.Command, args []string) { _, err := os.Stat("makefile") if err == nil { color.Yellow("makefile is already exist!\n") return } if err = os.WriteFile("makefile", []byte(makefileContent), 0666); err != nil { color.Red("generate makefile error, %v\n", err) return } color.Green("makefile added!") }, }
View Source
var ProtoApiContent string
View Source
var ProtoErrorContent string
Functions ¶
func GenerateProtoFile ¶
Types ¶
type TemplateInfo ¶
Click to show internal directories.
Click to hide internal directories.