1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 18:50:49 +00:00
Beego/orm/command.go

45 lines
560 B
Go
Raw Normal View History

2013-07-30 12:32:38 +00:00
package orm
import (
"flag"
"fmt"
"os"
)
func printHelp() {
}
func getSqlAll() (sql string) {
for _, mi := range modelCache.allOrdered() {
_ = mi
}
return
}
func runCommand() {
if len(os.Args) < 2 || os.Args[1] != "orm" {
return
}
_ = flag.NewFlagSet("orm command", flag.ExitOnError)
args := argString(os.Args[2:])
cmd := args.Get(0)
switch cmd {
case "syncdb":
case "sqlall":
sql := getSqlAll()
fmt.Println(sql)
default:
if cmd != "" {
fmt.Printf("unknown command %s", cmd)
} else {
printHelp()
}
os.Exit(2)
}
}