mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl/ctlv3: remove ETCDCTL_API warning
To make coverage stats happy 25bc65794f
.
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
6d773ffe96
commit
85e3c5ec37
@ -23,16 +23,9 @@ import (
|
|||||||
"github.com/coreos/etcd/etcdctl/ctlv3/command"
|
"github.com/coreos/etcd/etcdctl/ctlv3/command"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start(apiv string) {
|
func Start() {
|
||||||
// ETCDCTL_ARGS=etcdctl_test arg1 arg2...
|
// ETCDCTL_ARGS=etcdctl_test arg1 arg2...
|
||||||
// SetArgs() takes 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:])
|
rootCmd.SetArgs(strings.Split(os.Getenv("ETCDCTL_ARGS"), "\xe7\xcd")[1:])
|
||||||
os.Unsetenv("ETCDCTL_ARGS")
|
os.Unsetenv("ETCDCTL_ARGS")
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
|
@ -18,14 +18,7 @@ package ctlv3
|
|||||||
|
|
||||||
import "github.com/coreos/etcd/etcdctl/ctlv3/command"
|
import "github.com/coreos/etcd/etcdctl/ctlv3/command"
|
||||||
|
|
||||||
func Start(apiv string) {
|
func Start() {
|
||||||
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.SetUsageFunc(usageFunc)
|
rootCmd.SetUsageFunc(usageFunc)
|
||||||
// Make help just show the usage
|
// Make help just show the usage
|
||||||
rootCmd.SetHelpTemplate(`{{.UsageString}}`)
|
rootCmd.SetHelpTemplate(`{{.UsageString}}`)
|
||||||
|
@ -32,7 +32,7 @@ func main() {
|
|||||||
// unset apiEnv to avoid side-effect for future env and flag parsing.
|
// unset apiEnv to avoid side-effect for future env and flag parsing.
|
||||||
os.Unsetenv(apiEnv)
|
os.Unsetenv(apiEnv)
|
||||||
if len(apiv) == 0 || apiv == "3" {
|
if len(apiv) == 0 || apiv == "3" {
|
||||||
ctlv3.Start(apiv)
|
ctlv3.Start()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user