etcdctl/ctlv3: remove ETCDCTL_API warning

To make coverage stats happy 25bc65794f.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
release-3.4
Gyuho Lee 2018-05-31 12:24:37 -07:00
parent 6d773ffe96
commit 85e3c5ec37
3 changed files with 3 additions and 17 deletions

View File

@ -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 {

View File

@ -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}}`)

View File

@ -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
}