From 6c8791f5055950bcae4b2554019b44f48d987680 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 29 Oct 2018 15:34:11 +0000 Subject: [PATCH] Nest switches --- x/auth/client/cli/sign.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/x/auth/client/cli/sign.go b/x/auth/client/cli/sign.go index 4ea734355..cb128e38c 100644 --- a/x/auth/client/cli/sign.go +++ b/x/auth/client/cli/sign.go @@ -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