Browse Source

migrate/starter: fix --version output

Yicheng Qin 11 years ago
parent
commit
1ce7f6e0d0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      migrate/starter/starter.go

+ 7 - 0
migrate/starter/starter.go

@@ -34,6 +34,7 @@ import (
 	"github.com/coreos/etcd/pkg/flags"
 	"github.com/coreos/etcd/pkg/osutil"
 	"github.com/coreos/etcd/pkg/types"
+	etcdversion "github.com/coreos/etcd/version"
 
 	"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
 )
@@ -69,6 +70,10 @@ func StartDesiredVersion(args []string) {
 	if err != nil {
 		return
 	}
+	if fs.Lookup("version").Value.String() == "true" {
+		fmt.Println("etcd version", etcdversion.Version)
+		os.Exit(0)
+	}
 
 	ver := checkInternalVersion(fs)
 	log.Printf("starter: start etcd version %s", ver)
@@ -358,6 +363,8 @@ func (v *value) Set(s string) error {
 	return nil
 }
 
+func (v *value) IsBoolFlag() bool { return true }
+
 // parseConfig parses out the input config from cmdline arguments and
 // environment variables.
 func parseConfig(args []string) (*flag.FlagSet, error) {