diff --git a/etcd.go b/etcd.go index 05720fb357b..a0c6c5f3912 100644 --- a/etcd.go +++ b/etcd.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "io/ioutil" "os" "strings" @@ -31,6 +32,8 @@ var ( force bool + printVersion bool + maxSize int snapshot bool @@ -45,6 +48,8 @@ var ( ) func init() { + flag.BoolVar(&printVersion, "version", false, "print the version and exit") + flag.BoolVar(&log.Verbose, "v", false, "verbose logging") flag.BoolVar(&veryVerbose, "vv", false, "very verbose logging") @@ -116,6 +121,11 @@ type Info struct { func main() { flag.Parse() + if printVersion { + fmt.Println(server.ReleaseVersion) + os.Exit(0) + } + if cpuprofile != "" { runCPUProfile() } diff --git a/scripts/release-version b/scripts/release-version index c1fdaba0768..77db798378c 100755 --- a/scripts/release-version +++ b/scripts/release-version @@ -4,5 +4,5 @@ VER=$(git describe --tags HEAD) cat <