Browse Source

Merge pull request #210 from philips/add-version-flag

feat(etcd): add version flag
Brandon Philips 12 years ago
parent
commit
302347426e
1 changed files with 9 additions and 0 deletions
  1. 9 0
      etcd.go

+ 9 - 0
etcd.go

@@ -50,6 +50,8 @@ var (
 
 
 	force bool
 	force bool
 
 
+	printVersion bool
+
 	maxSize int
 	maxSize int
 
 
 	snapshot bool
 	snapshot bool
@@ -65,6 +67,8 @@ var (
 )
 )
 
 
 func init() {
 func init() {
+	flag.BoolVar(&printVersion, "version", false, "print the version and exit")
+
 	flag.BoolVar(&verbose, "v", false, "verbose logging")
 	flag.BoolVar(&verbose, "v", false, "verbose logging")
 	flag.BoolVar(&veryVerbose, "vv", false, "very verbose logging")
 	flag.BoolVar(&veryVerbose, "vv", false, "very verbose logging")
 
 
@@ -162,6 +166,11 @@ var etcdStore *store.Store
 func main() {
 func main() {
 	flag.Parse()
 	flag.Parse()
 
 
+	if printVersion {
+		fmt.Println(releaseVersion)
+		os.Exit(0)
+	}
+
 	if cpuprofile != "" {
 	if cpuprofile != "" {
 		runCPUProfile()
 		runCPUProfile()
 	}
 	}