|
|
@@ -18,6 +18,7 @@ import (
|
|
|
"fmt"
|
|
|
|
|
|
"github.com/coreos/etcd/version"
|
|
|
+ "github.com/coreos/go-semver/semver"
|
|
|
"github.com/spf13/cobra"
|
|
|
)
|
|
|
|
|
|
@@ -31,5 +32,13 @@ func NewVersionCommand() *cobra.Command {
|
|
|
}
|
|
|
|
|
|
func versionCommandFunc(cmd *cobra.Command, args []string) {
|
|
|
- fmt.Println(version.Version)
|
|
|
+ fmt.Println("etcdctl version:", version.Version)
|
|
|
+ ver, err := semver.NewVersion(version.Version)
|
|
|
+ var vs string
|
|
|
+ if err == nil {
|
|
|
+ vs = fmt.Sprintf("%d.%d", ver.Major, ver.Minor)
|
|
|
+ } else {
|
|
|
+ vs = "unknown"
|
|
|
+ }
|
|
|
+ fmt.Println("API version:", vs)
|
|
|
}
|