mirror of
https://github.com/beego/bee.git
synced 2024-11-24 03:20:55 +00:00
add InitToml and fmt code
This commit is contained in:
parent
62abed87e9
commit
b8213eba24
@ -36,7 +36,7 @@ func init() {
|
|||||||
|
|
||||||
func runFix(cmd *commands.Command, args []string) int {
|
func runFix(cmd *commands.Command, args []string) int {
|
||||||
t := target.String()
|
t := target.String()
|
||||||
if t == "" || t == "1.6"{
|
if t == "" || t == "1.6" {
|
||||||
return fixTo16(cmd, args)
|
return fixTo16(cmd, args)
|
||||||
} else if strings.HasPrefix(t, "2") {
|
} else if strings.HasPrefix(t, "2") {
|
||||||
// upgrade to v2
|
// upgrade to v2
|
||||||
|
@ -228,4 +228,3 @@ func fixFile(file string) error {
|
|||||||
}
|
}
|
||||||
return ioutil.WriteFile(file, []byte(fixed), 0666)
|
return ioutil.WriteFile(file, []byte(fixed), 0666)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,3 +208,21 @@ func (c *Container) flushTimestamp() {
|
|||||||
beeLogger.Log.Fatalf("flush timestamp tmpl parse error, err: %s", err)
|
beeLogger.Log.Fatalf("flush timestamp tmpl parse error, err: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Container) InitToml() {
|
||||||
|
if exist := utils.IsExist(c.BeegoProFile); exist {
|
||||||
|
beeLogger.Log.Fatalf("file beegopro.toml already exists")
|
||||||
|
}
|
||||||
|
sourceFile := c.UserOption.GitLocalPath + "/beegopro.toml"
|
||||||
|
input, err := ioutil.ReadFile(sourceFile)
|
||||||
|
if err != nil {
|
||||||
|
beeLogger.Log.Fatalf("read beegopro.toml file err, %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = ioutil.WriteFile(c.BeegoProFile, input, 0644)
|
||||||
|
if err != nil {
|
||||||
|
beeLogger.Log.Fatalf("create beegopro.toml file err, %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
beeLogger.Log.Success("Successfully created file beegopro.toml")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user