Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: hide --output flags that don't work #17188

Merged
merged 3 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x/auth/client/cli/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func GetDecodeCommand() *cobra.Command {

cmd.Flags().BoolP(flagHex, "x", false, "Treat input as hexadecimal instead of base64")
flags.AddTxFlagsToCmd(cmd)
_ = cmd.Flags().MarkHidden(flags.FlagOutput) //decoding makes sense to output only json
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved

return cmd
}
1 change: 1 addition & 0 deletions x/auth/client/cli/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea
}

flags.AddTxFlagsToCmd(cmd)
_ = cmd.Flags().MarkHidden(flags.FlagOutput) // encoding makes sense to output only json

return cmd
}
22 changes: 6 additions & 16 deletions x/auth/client/cli/tx_multisign.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The SIGN_MODE_DIRECT sign mode is not supported.'
cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit")
cmd.Flags().String(flags.FlagOutputDocument, "", "The document is written to the given file instead of STDOUT")
flags.AddTxFlagsToCmd(cmd)
_ = cmd.Flags().MarkHidden(flags.FlagOutput)

return cmd
}
Expand Down Expand Up @@ -180,27 +181,15 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) {
return err
}

outputDoc, _ := cmd.Flags().GetString(flags.FlagOutputDocument)
if outputDoc == "" {
cmd.Printf("%s\n", json)
return nil
}

fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
closeFunc, err := setOutputFile(cmd)
if err != nil {
return err
}

defer func() {
err2 := fp.Close()
if err == nil {
err = err2
}
}()

err = clientCtx.PrintBytes(json)
defer closeFunc()

return err
cmd.Printf("%s\n", json)
return nil
}
}

Expand Down Expand Up @@ -235,6 +224,7 @@ The SIGN_MODE_DIRECT sign mode is not supported.'
)
cmd.Flags().String(flags.FlagOutputDocument, "", "The document is written to the given file instead of STDOUT")
flags.AddTxFlagsToCmd(cmd)
_ = cmd.Flags().MarkHidden(flags.FlagOutput) // signing makes sense to output only json

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions x/genutil/client/cli/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ $ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=o
cmd.Flags().String(flags.FlagOutputDocument, "", "Write the genesis transaction JSON document to the given file instead of the default location")
cmd.Flags().AddFlagSet(fsCreateValidator)
flags.AddTxFlagsToCmd(cmd)
_ = cmd.Flags().MarkHidden(flags.FlagOutput) // signing makes sense to output only json

return cmd
}
Expand Down