mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4150 from gyuho/fix_arg_update_dir
etcdctl: get only the first argument for updatedir
This commit is contained in:
commit
f91d96c9a4
@ -16,7 +16,6 @@ package command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli"
|
||||
@ -44,15 +43,9 @@ func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) {
|
||||
handleError(ExitBadArgs, errors.New("key required"))
|
||||
}
|
||||
key := c.Args()[0]
|
||||
value, err := argOrStdin(c.Args(), os.Stdin, 1)
|
||||
if err != nil {
|
||||
handleError(ExitBadArgs, errors.New("value required"))
|
||||
}
|
||||
|
||||
ttl := c.Int("ttl")
|
||||
|
||||
ctx, cancel := contextWithTotalTimeout(c)
|
||||
_, err = ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist})
|
||||
_, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist})
|
||||
cancel()
|
||||
if err != nil {
|
||||
handleError(ExitServerError, err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user