x/auth/client: remove duplicate flags (#6348)

This commit is contained in:
Alessio Treglia 2020-06-05 16:14:22 +02:00 committed by GitHub
parent 1a5f2b7859
commit e248693ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -50,7 +50,7 @@ recommended to set such parameters manually.
}
cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit")
cmd.Flags().String(flagOutfile, "", "The document will be written to the given file instead of STDOUT")
cmd.Flags().String(flags.FlagOutputDocument, "", "The document will be written to the given file instead of STDOUT")
// Add the flags here and return the command
return flags.PostCommands(cmd)[0]
@ -131,13 +131,13 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string)
return err
}
if viper.GetString(flagOutfile) == "" {
if viper.GetString(flags.FlagOutputDocument) == "" {
fmt.Printf("%s\n", json)
return
}
fp, err := os.OpenFile(
viper.GetString(flagOutfile), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644,
viper.GetString(flags.FlagOutputDocument), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644,
)
if err != nil {
return err

View File

@ -18,7 +18,6 @@ const (
flagMultisig = "multisig"
flagAppend = "append"
flagSigOnly = "signature-only"
flagOutfile = "output-document"
)
// GetSignCommand returns the transaction sign command.
@ -55,7 +54,7 @@ be generated via the 'multisign' command.
"Append the signature to the existing ones. If disabled, old signatures would be overwritten. Ignored if --multisig is on",
)
cmd.Flags().Bool(flagSigOnly, false, "Print only the generated signature, then exit")
cmd.Flags().String(flagOutfile, "", "The document will be written to the given file instead of STDOUT")
cmd.Flags().String(flags.FlagOutputDocument, "", "The document will be written to the given file instead of STDOUT")
cmd = flags.PostCommands(cmd)[0]
cmd.MarkFlagRequired(flags.FlagFrom)
@ -108,13 +107,13 @@ func makeSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error
return err
}
if viper.GetString(flagOutfile) == "" {
if viper.GetString(flags.FlagOutputDocument) == "" {
fmt.Printf("%s\n", json)
return nil
}
fp, err := os.OpenFile(
viper.GetString(flagOutfile), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644,
viper.GetString(flags.FlagOutputDocument), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644,
)
if err != nil {
return err