github.com/lino-network/lino@v0.6.11/param/client/cli/query.go (about) 1 package cli 2 3 import ( 4 "fmt" 5 6 "github.com/cosmos/cosmos-sdk/client" 7 "github.com/cosmos/cosmos-sdk/codec" 8 "github.com/spf13/cobra" 9 10 // linotypes "github.com/lino-network/lino/types" 11 types "github.com/lino-network/lino/param" 12 "github.com/lino-network/lino/utils" 13 ) 14 15 func GetQueryCmd(cdc *codec.Codec) *cobra.Command { 16 cmd := &cobra.Command{ 17 Use: types.ModuleName, 18 Short: "Querying commands for the param module", 19 DisableFlagParsing: true, 20 SuggestionsMinimumDistance: 2, 21 RunE: client.ValidateCmd, 22 } 23 cmd.AddCommand(client.GetCommands( 24 getCmdAll(cdc), 25 )...) 26 return cmd 27 } 28 29 // GetCmdAll - 30 func getCmdAll(cdc *codec.Codec) *cobra.Command { 31 return &cobra.Command{ 32 Use: "all", 33 Short: "all print all blockchain parameters", 34 Args: cobra.ExactArgs(0), 35 RunE: func(cmd *cobra.Command, args []string) error { 36 all := []struct { 37 path string 38 t interface{} 39 }{ 40 {types.QueryAllocationParam, &types.GlobalAllocationParam{}}, 41 {types.QueryDeveloperParam, &types.DeveloperParam{}}, 42 {types.QueryVoteParam, &types.VoteParam{}}, 43 {types.QueryProposalParam, &types.ProposalParam{}}, 44 {types.QueryValidatorParam, &types.ValidatorParam{}}, 45 {types.QueryBandwidthParam, &types.BandwidthParam{}}, 46 {types.QueryAccountParam, &types.AccountParam{}}, 47 {types.QueryPostParam, &types.PostParam{}}, 48 {types.QueryReputationParam, &types.ReputationParam{}}, 49 {types.QueryPriceParam, &types.PriceParam{}}, 50 } 51 for _, v := range all { 52 uri := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, v.path) 53 fmt.Print(v.path) 54 err := utils.CLIQueryJSONPrint(cdc, uri, nil, 55 func() interface{} { return v.t }) 56 if err != nil { 57 return err 58 } 59 } 60 return nil 61 }, 62 } 63 }