Added version flag for command line.

This commit is contained in:
Sascha L. Teichmann 2014-08-06 10:04:24 +02:00
parent 3f97399a82
commit 66b85f199c
1 changed files with 9 additions and 0 deletions

View File

@ -13,19 +13,28 @@ import (
"os/signal"
)
const Version = "pre0.1"
func main() {
var port int
var host string
var driver string
var cacheSize int
var version bool
flag.IntVar(&port, "port", 6379, "port to bind")
flag.StringVar(&driver, "driver", "leveldb", "type of database (leveldb, sqlite)")
flag.StringVar(&host, "host", "", "host to bind")
flag.IntVar(&cacheSize, "cache", 32, "cache size in MB")
flag.BoolVar(&version, "version", false, "Print version and exit.")
flag.Parse()
if version {
fmt.Printf("Version: %s\n", Version)
os.Exit(0)
}
args := flag.Args()
if len(args) < 1 {