1
0
mirror of https://github.com/beego/bee.git synced 2024-11-26 01:11:30 +00:00

load params from json and minor output format fix

This commit is contained in:
ZhengYang 2014-08-13 14:48:20 +08:00
parent 64f3acca26
commit e455509adb

17
g.go
View File

@ -102,19 +102,30 @@ func generateCode(cmd *Command, args []string) {
case "docs":
generateDocs(curpath)
case "appcode":
// load config
err := loadConfig()
if err != nil {
ColorLog("[ERRO] Fail to parse bee.json[ %s ]\n", err)
}
cmd.Flag.Parse(args[1:])
if driver == "" {
driver = "mysql"
driver = docValue(conf.Database.Driver)
if driver == "" {
driver = "mysql"
}
}
if conn == "" {
conn = "root:@tcp(127.0.0.1:3306)/test"
conn = docValue(conf.Database.Conn)
if conn == "" {
conn = "root:@tcp(127.0.0.1:3306)/test"
}
}
if level == "" {
level = "3"
}
ColorLog("[INFO] Using '%s' as 'driver'\n", driver)
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)
generateAppcode(string(driver), string(conn), string(level), string(tables), curpath)
case "migration":