mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: Rename Start / StartWithErrors to MustStart
This commit is contained in:
parent
c32180d772
commit
7c880e5263
@ -26,7 +26,7 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func StartWithError() error {
|
||||
func Start() error {
|
||||
app := cli.NewApp()
|
||||
app.Name = "etcdctl"
|
||||
app.Version = version.Version
|
||||
@ -75,8 +75,8 @@ func StartWithError() error {
|
||||
return app.Run(os.Args)
|
||||
}
|
||||
|
||||
func Start() {
|
||||
err := StartWithError()
|
||||
func MustStart() {
|
||||
err := Start()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
|
@ -95,15 +95,15 @@ func init() {
|
||||
)
|
||||
}
|
||||
|
||||
func StartWithError() error {
|
||||
func Start() error {
|
||||
rootCmd.SetUsageFunc(usageFunc)
|
||||
// Make help just show the usage
|
||||
rootCmd.SetHelpTemplate(`{{.UsageString}}`)
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
func Start() {
|
||||
if err := StartWithError(); err != nil {
|
||||
func MustStart() {
|
||||
if err := Start(); err != nil {
|
||||
command.ExitWithError(command.ExitError, err)
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ func mainWithError() error {
|
||||
os.Unsetenv(apiEnv)
|
||||
|
||||
if len(apiv) == 0 || apiv == "3" {
|
||||
return ctlv3.StartWithError()
|
||||
return ctlv3.Start()
|
||||
}
|
||||
|
||||
if apiv == "2" {
|
||||
return ctlv2.StartWithError()
|
||||
return ctlv2.Start()
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "unsupported API version: %s\n", apiv)
|
||||
@ -56,12 +56,12 @@ 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()
|
||||
ctlv3.MustStart()
|
||||
return
|
||||
}
|
||||
|
||||
if apiv == "2" {
|
||||
ctlv2.Start()
|
||||
ctlv2.MustStart()
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user