1 Star 0 Fork 0

waiot / kit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.go 817 Bytes
一键复制 编辑 原始数据 按行查看 历史
package root
import (
"gitee.com/waiot/kit/internal/pkg/config"
"github.com/spf13/cobra"
)
var configCmd = &cobra.Command{
Use: "config",
Aliases: []string{"cfg", "c"},
Short: "Generate config templates",
Long: "Generate config templates",
Run: func(cmd *cobra.Command, args []string) {
types := []string{"ini", "json", "toml", "xml", "yaml", "yml"}
for _, t := range types {
cf := config.File{
Path: path,
Name: name,
Type: t,
}
err = cf.Generate(name)
cobra.CheckErr(err)
}
},
}
func init() {
configCmd.Flags().StringVarP(&path, "path", "p", "./templates/configs", "generate config's file templates path.")
configCmd.Flags().StringVarP(&name, "name", "n", "application", "generate config's file templates name.")
configCmd.ParseFlags([]string{"path", "name"})
}
Go
1
https://gitee.com/waiot/kit.git
git@gitee.com:waiot/kit.git
waiot
kit
kit
e5f6f6ee3716

搜索帮助

53164aa7 5694891 3bd8fe86 5694891