From d49a6c64f525e5498a093d7843d6b478516f7e8c Mon Sep 17 00:00:00 2001 From: Peter Gilbert Date: Fri, 17 Jan 2020 11:28:11 -0800 Subject: [PATCH] go/oasis-node: Include account ID in `stake list -v` cmd --- .changelog/2567.bugfix.md | 3 +++ go/oasis-node/cmd/stake/stake.go | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .changelog/2567.bugfix.md diff --git a/.changelog/2567.bugfix.md b/.changelog/2567.bugfix.md new file mode 100644 index 00000000000..dc7581ced41 --- /dev/null +++ b/.changelog/2567.bugfix.md @@ -0,0 +1,3 @@ +go/oasis-node: Include account ID in `stake list -v` subcommand. + +Changes `stake list -v` subcommand to return a map of IDs to accounts. diff --git a/go/oasis-node/cmd/stake/stake.go b/go/oasis-node/cmd/stake/stake.go index 39d359e620c..528232b8c29 100644 --- a/go/oasis-node/cmd/stake/stake.go +++ b/go/oasis-node/cmd/stake/stake.go @@ -150,15 +150,17 @@ func doList(cmd *cobra.Command, args []string) { return err }) - for _, v := range ids { - if !cmdFlags.Verbose() { - fmt.Printf("%v\n", v) - continue + if cmdFlags.Verbose() { + accts := make(map[signature.PublicKey]*api.Account) + for _, v := range ids { + accts[v] = getAccountInfo(ctx, cmd, v, client) } - - ai := getAccountInfo(ctx, cmd, v, client) - b, _ := json.Marshal(ai) + b, _ := json.Marshal(accts) fmt.Printf("%v\n", string(b)) + } else { + for _, v := range ids { + fmt.Printf("%v\n", v) + } } }