Browse Source

feat(etcd): add version flag

print the version and exit, very simple :)

Conflicts:
	etcd.go
Brandon Philips 12 years ago
parent
commit
f998a19c3d
1 changed files with 9 additions and 0 deletions
  1. 9 0
      etcd.go

+ 9 - 0
etcd.go

@@ -31,6 +31,8 @@ var (
 
 	force bool
 
+	printVersion bool
+
 	maxSize int
 
 	snapshot bool
@@ -45,6 +47,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 +120,11 @@ type Info struct {
 func main() {
 	flag.Parse()
 
+	if printVersion {
+		fmt.Println(releaseVersion)
+		os.Exit(0)
+	}
+
 	if cpuprofile != "" {
 		runCPUProfile()
 	}