etcdctl/ctlv2/command/ls_command.go
func lsCommandFunc(c *cli.Context, ki client.KeysAPI) {
	key := "/"
	if len(c.Args()) != 0 {
		key = c.Args()[0]
	}

	sort := c.Bool("sort")
	recursive := c.Bool("recursive")
	quorum := c.Bool("quorum")

	ctx, cancel := contextWithTotalTimeout(c)
	resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sort, Recursive: recursive, Quorum: quorum})
	cancel()
	if err != nil {
		handleError(c, ExitServerError, err)
	}

	printLs(c, resp)
}
func lsCommandFunc(c *cli.Context, ki client.KeysAPI) {
	key := "/"
	if len(c.Args()) != 0 {
		key = c.Args()[0]
	}

	sort := c.Bool("sort")
	recursive := c.Bool("recursive")
	quorum := c.Bool("quorum")

	ctx, cancel := contextWithTotalTimeout(c)
	resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sort, Recursive: recursive, Quorum: quorum})
	cancel()
	if err != nil {
		handleError(c, ExitServerError, err)
	}

	printLs(c, resp)
}
func lsCommandFunc ( c * cli . Context , ki client . KeysAPI ) { key := " " if len ( c . Args ( ) ) != 0 { key = c . Args ( ) [ 0 ] } sort := c . Bool ( " " ) recursive := c . Bool ( " " ) quorum := c . Bool ( " " ) ctx , cancel := contextWithTotalTimeout ( c ) resp , err := ki . Get ( ctx , key , & client . GetOptions { Sort : sort , Recursive : recursive , Quorum : quorum } ) cancel ( ) if err != nil { handleError ( c , ExitServerError , err ) } printLs ( c , resp ) }
// lsCommandFunc executes the "ls" command.
lsCommandFunc executes the ls command .