mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Refactor common code from etcdctl (v2,v3) to pkg/corbautl.
Preparation for etcdutl split.
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"go.etcd.io/etcd/client/v2"
|
||||
"go.etcd.io/etcd/pkg/v3/cobrautl"
|
||||
)
|
||||
|
||||
// NewUpdateDirCommand returns the CLI command for "updatedir".
|
||||
@@ -41,7 +42,7 @@ func NewUpdateDirCommand() cli.Command {
|
||||
// updatedirCommandFunc executes the "updatedir" command.
|
||||
func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) {
|
||||
if len(c.Args()) == 0 {
|
||||
handleError(c, ExitBadArgs, errors.New("key required"))
|
||||
handleError(c, cobrautl.ExitBadArgs, errors.New("key required"))
|
||||
}
|
||||
key := c.Args()[0]
|
||||
ttl := c.Int("ttl")
|
||||
@@ -49,7 +50,7 @@ func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) {
|
||||
resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist})
|
||||
cancel()
|
||||
if err != nil {
|
||||
handleError(c, ExitServerError, err)
|
||||
handleError(c, cobrautl.ExitServerError, err)
|
||||
}
|
||||
if c.GlobalString("output") != "simple" {
|
||||
printResponseKey(resp, c.GlobalString("output"))
|
||||
|
||||
Reference in New Issue
Block a user