Merge PR #3887: Add indent to prompt of gaiacli tx send

* Add indent to prompt of `gaiacli tx send`.
* Add indent to prompt of `gaiacli tx send` with flag --indent.
This commit is contained in:
Frank Yang
2019-03-15 16:08:05 +01:00
committed by Christopher Goes
parent 868d44879c
commit 5081c930de
+11 -1
View File
@@ -3,6 +3,7 @@ package utils
import (
"bytes"
"fmt"
"github.com/spf13/viper"
"io/ioutil"
"os"
@@ -69,7 +70,16 @@ func CompleteAndBroadcastTxCLI(txBldr authtxb.TxBuilder, cliCtx context.CLIConte
return err
}
fmt.Fprintf(os.Stderr, "%s\n\n", cliCtx.Codec.MustMarshalJSON(stdSignMsg))
var json []byte
if viper.GetBool(client.FlagIndentResponse) {
json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ")
if err != nil {
panic(err)
}
} else {
json = cliCtx.Codec.MustMarshalJSON(stdSignMsg)
}
fmt.Fprintf(os.Stderr, "%s\n\n", json)
buf := client.BufferStdin()
ok, err := client.GetConfirmation("confirm transaction before signing and broadcasting", buf)