From 8721bf410be4d3c8aa2d31b99b1464bfa77a07fb Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 25 Jun 2014 14:22:31 +0800 Subject: [PATCH] move redid-cli to cmd --- {client/go => cmd}/ledis-cli/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename {client/go => cmd}/ledis-cli/main.go (87%) diff --git a/client/go/ledis-cli/main.go b/cmd/ledis-cli/main.go similarity index 87% rename from client/go/ledis-cli/main.go rename to cmd/ledis-cli/main.go index 2be69bc..586c1ab 100644 --- a/client/go/ledis-cli/main.go +++ b/cmd/ledis-cli/main.go @@ -40,13 +40,13 @@ func main() { } else { args := make([]interface{}, len(cmds[1:])) for i := range args { - args[i] = cmds[1+i] + args[i] = strings.Trim(string(cmds[1+i]), "\"") } r, err := c.Do(cmds[0], args...) if err != nil { fmt.Printf("%s", err.Error()) } else { - printReply(r) + printReply(cmd, r) } fmt.Printf("\n") @@ -54,16 +54,16 @@ func main() { } } -func printReply(reply interface{}) { +func printReply(cmd string, reply interface{}) { switch reply := reply.(type) { case int64: fmt.Printf("(integer) %d", reply) case string: - fmt.Printf("%q", reply) + fmt.Printf("%s", reply) case []byte: - fmt.Printf("%q", reply) + fmt.Printf("%s", string(reply)) case nil: - fmt.Printf("(empty list or set)") + fmt.Printf("(nil)") case ledis.Error: fmt.Printf("%s", string(reply)) case []interface{}: