Skip to content

Commit

Permalink
etcdctl/ctlv3: remove ETCDCTL_API warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed May 31, 2018
1 parent 6d773ff commit 85e3c5e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
9 changes: 1 addition & 8 deletions etcdctl/ctlv3/ctl_cov.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,9 @@ import (
"github.com/coreos/etcd/etcdctl/ctlv3/command"
)

func Start(apiv string) {
func Start() {
// ETCDCTL_ARGS=etcdctl_test arg1 arg2...
// SetArgs() takes arg1 arg2...
if apiv == "" {
rootCmd.Short += "\n\n" +
"WARNING:\n" +
" Environment variable ETCDCTL_API is not set; defaults to etcdctl v3.\n" +
" Set environment variable ETCDCTL_API=2 to use v2 API or ETCDCTL_API=3 to use v3 API."

}
rootCmd.SetArgs(strings.Split(os.Getenv("ETCDCTL_ARGS"), "\xe7\xcd")[1:])
os.Unsetenv("ETCDCTL_ARGS")
if err := rootCmd.Execute(); err != nil {
Expand Down
9 changes: 1 addition & 8 deletions etcdctl/ctlv3/ctl_nocov.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@ package ctlv3

import "github.com/coreos/etcd/etcdctl/ctlv3/command"

func Start(apiv string) {
if apiv == "" {
rootCmd.Short += "\n\n" +
"WARNING:\n" +
" Environment variable ETCDCTL_API is not set; defaults to etcdctl v3.\n" +
" Set environment variable ETCDCTL_API=2 to use v2 API or ETCDCTL_API=3 to use v3 API."

}
func Start() {
rootCmd.SetUsageFunc(usageFunc)
// Make help just show the usage
rootCmd.SetHelpTemplate(`{{.UsageString}}`)
Expand Down
2 changes: 1 addition & 1 deletion etcdctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {
// unset apiEnv to avoid side-effect for future env and flag parsing.
os.Unsetenv(apiEnv)
if len(apiv) == 0 || apiv == "3" {
ctlv3.Start(apiv)
ctlv3.Start()
return
}

Expand Down

0 comments on commit 85e3c5e

Please sign in to comment.