mirror of
https://github.com/beego/bee.git
synced 2024-11-23 01:30:55 +00:00
load params from json and minor output format fix
This commit is contained in:
parent
64f3acca26
commit
e455509adb
13
g.go
13
g.go
@ -102,19 +102,30 @@ func generateCode(cmd *Command, args []string) {
|
|||||||
case "docs":
|
case "docs":
|
||||||
generateDocs(curpath)
|
generateDocs(curpath)
|
||||||
case "appcode":
|
case "appcode":
|
||||||
|
// load config
|
||||||
|
err := loadConfig()
|
||||||
|
if err != nil {
|
||||||
|
ColorLog("[ERRO] Fail to parse bee.json[ %s ]\n", err)
|
||||||
|
}
|
||||||
cmd.Flag.Parse(args[1:])
|
cmd.Flag.Parse(args[1:])
|
||||||
|
if driver == "" {
|
||||||
|
driver = docValue(conf.Database.Driver)
|
||||||
if driver == "" {
|
if driver == "" {
|
||||||
driver = "mysql"
|
driver = "mysql"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if conn == "" {
|
||||||
|
conn = docValue(conf.Database.Conn)
|
||||||
if conn == "" {
|
if conn == "" {
|
||||||
conn = "root:@tcp(127.0.0.1:3306)/test"
|
conn = "root:@tcp(127.0.0.1:3306)/test"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if level == "" {
|
if level == "" {
|
||||||
level = "3"
|
level = "3"
|
||||||
}
|
}
|
||||||
ColorLog("[INFO] Using '%s' as 'driver'\n", driver)
|
ColorLog("[INFO] Using '%s' as 'driver'\n", driver)
|
||||||
ColorLog("[INFO] Using '%s' as 'conn'\n", conn)
|
ColorLog("[INFO] Using '%s' as 'conn'\n", conn)
|
||||||
ColorLog("[INFO] Using '%s' as 'tables'", tables)
|
ColorLog("[INFO] Using '%s' as 'tables'\n", tables)
|
||||||
ColorLog("[INFO] Using '%s' as 'level'\n", level)
|
ColorLog("[INFO] Using '%s' as 'level'\n", level)
|
||||||
generateAppcode(string(driver), string(conn), string(level), string(tables), curpath)
|
generateAppcode(string(driver), string(conn), string(level), string(tables), curpath)
|
||||||
case "migration":
|
case "migration":
|
||||||
|
Loading…
Reference in New Issue
Block a user