From af30cb87251d2a2b7d50a12eabdb7ede20b74b05 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Wed, 9 Oct 2013 14:26:49 -0700 Subject: [PATCH] feat(etcd): add version flag print the version and exit, very simple :) --- etcd.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etcd.go b/etcd.go index 7e6eb86d5..c1b6b9e02 100644 --- a/etcd.go +++ b/etcd.go @@ -50,6 +50,8 @@ var ( force bool + printVersion bool + maxSize int snapshot bool @@ -65,6 +67,8 @@ var ( ) func init() { + flag.BoolVar(&printVersion, "version", false, "print the version and exit") + flag.BoolVar(&verbose, "v", false, "verbose logging") flag.BoolVar(&veryVerbose, "vv", false, "very verbose logging") @@ -162,6 +166,11 @@ var etcdStore *store.Store func main() { flag.Parse() + if printVersion { + fmt.Println(releaseVersion) + os.Exit(0) + } + if cpuprofile != "" { runCPUProfile() }