From 9527a97720d65a61b127775563f278012340d93d Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 4 Aug 2015 22:56:55 -0700 Subject: [PATCH] etcdctl: ls takes / as default key arg --- etcdctl/command/ls_command.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etcdctl/command/ls_command.go b/etcdctl/command/ls_command.go index 095d8b723..bfb1c9ebb 100644 --- a/etcdctl/command/ls_command.go +++ b/etcdctl/command/ls_command.go @@ -15,7 +15,6 @@ package command import ( - "errors" "fmt" "github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli" @@ -40,11 +39,11 @@ func NewLsCommand() cli.Command { // lsCommandFunc executes the "ls" command. func lsCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(ExitBadArgs, errors.New("key required")) + key := "/" + if len(c.Args()) != 0 { + key = c.Args()[0] } - key := c.Args()[0] sort := c.Bool("sort") recursive := c.Bool("recursive")