Nest switches

This commit is contained in:
Alessio Treglia 2018-10-29 15:34:11 +00:00
parent 84aef0d106
commit 6c8791f505
No known key found for this signature in database
GPG Key ID: E8A48AE5311D765A
1 changed files with 15 additions and 9 deletions

View File

@ -81,15 +81,21 @@ func makeSignCmd(cdc *amino.Codec, decoder auth.AccountDecoder) func(cmd *cobra.
var json []byte
switch {
case generateSignatureOnly && cliCtx.Indent:
json, err = cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ")
case generateSignatureOnly && !cliCtx.Indent:
json, err = cdc.MarshalJSON(newTx.Signatures[0])
case !generateSignatureOnly && cliCtx.Indent:
json, err = cdc.MarshalJSONIndent(newTx, "", " ")
case !generateSignatureOnly && !cliCtx.Indent:
json, err = cdc.MarshalJSON(newTx)
switch generateSignatureOnly {
case true:
switch cliCtx.Indent {
case true:
json, err = cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ")
default:
json, err = cdc.MarshalJSON(newTx.Signatures[0])
}
default:
switch cliCtx.Indent {
case true:
json, err = cdc.MarshalJSONIndent(newTx, "", " ")
default:
json, err = cdc.MarshalJSON(newTx)
}
}
if err != nil {
return err