func main() { // No command? It's time for usage. if len(os.Args) == 1 { Usage() os.Exit(1) } cmd := os.Args[1] newargs := make([]string, 0) newargs = append(newargs, os.Args[0]) newargs = append(newargs, os.Args[2:]...) os.Args = newargs flag.Parse() var ts graph.TripleStore config := cfg.ParseConfigFromFlagsAndFile(*configFile) if os.Getenv("GOMAXPROCS") == "" { runtime.GOMAXPROCS(runtime.NumCPU()) glog.Infoln("Setting GOMAXPROCS to", runtime.NumCPU()) } else { glog.Infoln("GOMAXPROCS currently", os.Getenv("GOMAXPROCS"), " -- not adjusting") } switch cmd { case "init": cayley.CayleyInit(config, *tripleFile) case "load": ts = cayley.OpenTSFromConfig(config) cayley.CayleyLoad(ts, config, *tripleFile, false) ts.Close() case "repl": ts = cayley.OpenTSFromConfig(config) cayley.CayleyRepl(ts, *queryLanguage, config) ts.Close() case "http": ts = cayley.OpenTSFromConfig(config) cayley_http.CayleyHTTP(ts, config) ts.Close() default: fmt.Println("No command", cmd) flag.Usage() } }