Add SilenceUsage flag to hide menu when an error occurs. (#1068)
* Add SilenceUsage flag to hide menu when an error occurs. * Fix lint errors
This commit is contained in:
@@ -68,6 +68,7 @@ func GenesisStoreCodeCmd(defaultNodeHome string, genesisMutator GenesisMutator)
|
||||
return nil
|
||||
})
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flagRunAs, "", "The address that is stored as code creator")
|
||||
cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional")
|
||||
@@ -136,6 +137,7 @@ func GenesisInstantiateContractCmd(defaultNodeHome string, genesisMutator Genesi
|
||||
return nil
|
||||
})
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
|
||||
cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists")
|
||||
@@ -189,6 +191,7 @@ func GenesisExecuteContractCmd(defaultNodeHome string, genesisMutator GenesisMut
|
||||
return nil
|
||||
})
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract along with command")
|
||||
cmd.Flags().String(flagRunAs, "", "The address that pays the funds.")
|
||||
@@ -217,6 +220,7 @@ func GenesisListCodesCmd(defaultNodeHome string, genReader GenesisReader) *cobra
|
||||
}
|
||||
return printJSONOutput(cmd, all)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
@@ -239,6 +243,7 @@ func GenesisListContractsCmd(defaultNodeHome string, genReader GenesisReader) *c
|
||||
all := GetAllContracts(state)
|
||||
return printJSONOutput(cmd, all)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
@@ -80,6 +80,7 @@ func ProposalStoreCodeCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagRunAs, "", "The address that is stored as code creator")
|
||||
@@ -156,6 +157,7 @@ func ProposalInstantiateContractCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
|
||||
cmd.Flags().String(flagLabel, "", "A human-readable name for this contract in lists")
|
||||
@@ -221,6 +223,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
// proposal flags
|
||||
@@ -295,6 +298,7 @@ func ProposalExecuteContractCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.Flags().String(flagRunAs, "", "The address that is passed as sender to the contract on proposal execution")
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
|
||||
@@ -354,6 +358,7 @@ func ProposalSudoContractCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
// proposal flagsExecute
|
||||
@@ -413,6 +418,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
// proposal flags
|
||||
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
|
||||
@@ -465,6 +471,7 @@ func ProposalClearContractAdminCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
// proposal flags
|
||||
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
|
||||
@@ -521,6 +528,7 @@ func ProposalPinCodesCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
// proposal flags
|
||||
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
|
||||
@@ -589,6 +597,7 @@ func ProposalUnpinCodesCmd() *cobra.Command {
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
// proposal flags
|
||||
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
|
||||
@@ -704,6 +713,7 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1
|
||||
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
// proposal flags
|
||||
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
|
||||
|
||||
@@ -34,6 +34,7 @@ func MigrateContractCmd() *cobra.Command {
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -79,6 +80,7 @@ func UpdateContractAdminCmd() *cobra.Command {
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -115,6 +117,7 @@ func ClearContractAdminCmd() *cobra.Command {
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
return cmd
|
||||
|
||||
@@ -28,6 +28,7 @@ func GetQueryCmd() *cobra.Command {
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
queryCmd.AddCommand(
|
||||
GetCmdListCode(),
|
||||
@@ -137,6 +138,7 @@ func GetCmdListCode() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "list codes")
|
||||
@@ -182,6 +184,7 @@ func GetCmdListContractByCode() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "list contracts by code")
|
||||
@@ -224,6 +227,7 @@ func GetCmdQueryCode() *cobra.Command {
|
||||
fmt.Printf("Downloading wasm code to %s\n", args[1])
|
||||
return os.WriteFile(args[1], res.Data, 0o600)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -263,6 +267,7 @@ func GetCmdQueryCodeInfo() *cobra.Command {
|
||||
|
||||
return clientCtx.PrintProto(res.CodeInfoResponse)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -298,6 +303,7 @@ func GetCmdGetContractInfo() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -312,6 +318,7 @@ func GetCmdGetContractState() *cobra.Command {
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.AddCommand(
|
||||
GetCmdGetContractStateAll(),
|
||||
@@ -355,6 +362,7 @@ func GetCmdGetContractStateAll() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "contract state")
|
||||
@@ -396,6 +404,7 @@ func GetCmdGetContractStateRaw() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
decoder.RegisterFlags(cmd.PersistentFlags(), "key argument")
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
@@ -444,6 +453,7 @@ func GetCmdGetContractStateSmart() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
decoder.RegisterFlags(cmd.PersistentFlags(), "query argument")
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
@@ -487,6 +497,7 @@ func GetCmdGetContractHistory() *cobra.Command {
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
@@ -499,7 +510,7 @@ func GetCmdListPinnedCode() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "pinned",
|
||||
Short: "List all pinned code ids",
|
||||
Long: "\t\tLong: List all pinned code ids,\n",
|
||||
Long: "List all pinned code ids",
|
||||
Args: cobra.ExactArgs(0),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
@@ -523,6 +534,7 @@ func GetCmdListPinnedCode() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "list codes")
|
||||
@@ -534,7 +546,7 @@ func GetCmdListContractsByCreator() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "list-contracts-by-creator [creator]",
|
||||
Short: "List all contracts by creator",
|
||||
Long: "\t\tLong: List all contracts by creator,\n",
|
||||
Long: "List all contracts by creator",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
@@ -563,6 +575,7 @@ func GetCmdListContractsByCreator() *cobra.Command {
|
||||
}
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
return cmd
|
||||
@@ -650,6 +663,7 @@ func GetCmdQueryParams() *cobra.Command {
|
||||
|
||||
return clientCtx.PrintProto(&res.Params)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
@@ -42,6 +42,7 @@ func GetTxCmd() *cobra.Command {
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
txCmd.AddCommand(
|
||||
StoreCodeCmd(),
|
||||
@@ -76,6 +77,7 @@ func StoreCodeCmd() *cobra.Command {
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagInstantiateByEverybody, "", "Everybody can instantiate a contract from the code, optional")
|
||||
@@ -202,6 +204,7 @@ $ %s tx wasm instantiate 1 '{"foo":"bar"}' --admin="$(%s keys show mykey -a)" \
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
|
||||
@@ -262,6 +265,7 @@ $ %s tx wasm instantiate2 1 '{"foo":"bar"}' $(echo -n "testing" | xxd -ps) --adm
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
|
||||
@@ -347,6 +351,7 @@ func ExecuteContractCmd() *cobra.Command {
|
||||
}
|
||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
cmd.Flags().String(flagAmount, "", "Coins to send to the contract along with command")
|
||||
|
||||
Reference in New Issue
Block a user