mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: print full json response for Get
Otherwise parsing get/txn output with json is somewhat complicated because in some cases there's a json message and sometimes not. Likewise, a get on an absent key has to return the current revision for some algorithms to work.
This commit is contained in:
parent
0c40f4a7e3
commit
d2a58cbb0a
@ -100,7 +100,7 @@ func getFormatTest(cx ctlCtx) {
|
||||
wstr string
|
||||
}{
|
||||
{"simple", "abc"},
|
||||
{"json", "\"key\":\"YWJj\""},
|
||||
{"json", `"kvs":[{"key":"YWJj"`},
|
||||
{"protobuf", "\x17\b\x93\xe7\xf6\x93\xd4ņ\xe14\x10\xed"},
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ TODO: add consistency, from, prefix
|
||||
|
||||
##### JSON reply
|
||||
|
||||
The JSON encoding of the [RPC message][etcdrpc] for a key-value pair for each fetched key-value.
|
||||
The JSON encoding of the [RPC response][etcdrpc] for the GET's Range request.
|
||||
|
||||
##### Protobuf reply
|
||||
|
||||
|
@ -163,12 +163,8 @@ func (s *simplePrinter) DBStatus(ds dbstatus) {
|
||||
|
||||
type jsonPrinter struct{}
|
||||
|
||||
func (p *jsonPrinter) Del(r v3.DeleteResponse) { printJSON(r) }
|
||||
func (p *jsonPrinter) Get(r v3.GetResponse) {
|
||||
for _, kv := range r.Kvs {
|
||||
printJSON(kv)
|
||||
}
|
||||
}
|
||||
func (p *jsonPrinter) Del(r v3.DeleteResponse) { printJSON(r) }
|
||||
func (p *jsonPrinter) Get(r v3.GetResponse) { printJSON(r) }
|
||||
func (p *jsonPrinter) Put(r v3.PutResponse) { printJSON(r) }
|
||||
func (p *jsonPrinter) Txn(r v3.TxnResponse) { printJSON(r) }
|
||||
func (p *jsonPrinter) Watch(r v3.WatchResponse) { printJSON(r) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user