fix usage to make more sense
This commit is contained in:
parent
d2b1d64de3
commit
8136f2abe9
1 changed files with 16 additions and 9 deletions
25
cayley.go
25
cayley.go
|
|
@ -49,16 +49,14 @@ func Usage() {
|
||||||
fmt.Println("\nUsage:")
|
fmt.Println("\nUsage:")
|
||||||
fmt.Println(" cayley COMMAND [flags]")
|
fmt.Println(" cayley COMMAND [flags]")
|
||||||
fmt.Println("\nCommands:")
|
fmt.Println("\nCommands:")
|
||||||
fmt.Println(" init\tCreate an empty database.")
|
fmt.Println(" init Create an empty database.")
|
||||||
fmt.Println(" load\tBulk-load a triple file into the database.")
|
fmt.Println(" load Bulk-load a triple file into the database.")
|
||||||
fmt.Println(" http\tServe an HTTP endpoint on the given host and port.")
|
fmt.Println(" http Serve an HTTP endpoint on the given host and port.")
|
||||||
fmt.Println(" repl\tDrop into a REPL of the given query language.")
|
fmt.Println(" repl Drop into a REPL of the given query language.")
|
||||||
|
fmt.Println(" version Version information.")
|
||||||
fmt.Println("\nFlags:")
|
fmt.Println("\nFlags:")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
if VERSION != "" {
|
|
||||||
fmt.Printf("Release v%s\n", VERSION)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -69,14 +67,16 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := os.Args[1]
|
cmd := os.Args[1]
|
||||||
newargs := make([]string, 0)
|
var newargs []string
|
||||||
newargs = append(newargs, os.Args[0])
|
newargs = append(newargs, os.Args[0])
|
||||||
newargs = append(newargs, os.Args[2:]...)
|
newargs = append(newargs, os.Args[2:]...)
|
||||||
os.Args = newargs
|
os.Args = newargs
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
var buildString string
|
||||||
if VERSION != "" {
|
if VERSION != "" {
|
||||||
glog.Info("Cayley v", VERSION, " built ", BUILD_DATE)
|
buildString = fmt.Sprint("Cayley ", VERSION, " built ", BUILD_DATE)
|
||||||
|
glog.Infoln(buildString)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.ParseConfigFromFlagsAndFile(*configFile)
|
cfg := config.ParseConfigFromFlagsAndFile(*configFile)
|
||||||
|
|
@ -93,6 +93,13 @@ func main() {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
switch cmd {
|
switch cmd {
|
||||||
|
case "version":
|
||||||
|
if VERSION != "" {
|
||||||
|
fmt.Println(buildString)
|
||||||
|
} else {
|
||||||
|
fmt.Println("Cayley snapshot")
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
case "init":
|
case "init":
|
||||||
err = db.Init(cfg, *tripleFile)
|
err = db.Init(cfg, *tripleFile)
|
||||||
case "load":
|
case "load":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue