github.com/lino-network/lino@v0.6.11/x/reputation/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 "github.com/lino-network/lino/utils" 12 types "github.com/lino-network/lino/x/reputation" 13 ) 14 15 func GetQueryCmd(cdc *codec.Codec) *cobra.Command { 16 cmd := &cobra.Command{ 17 Use: types.ModuleName, 18 Short: "Querying commands for the reputation module", 19 DisableFlagParsing: true, 20 SuggestionsMinimumDistance: 2, 21 RunE: client.ValidateCmd, 22 } 23 cmd.AddCommand(client.GetCommands( 24 getCmdShow(cdc), 25 )...) 26 return cmd 27 } 28 29 // GetCmdShow - 30 func getCmdShow(cdc *codec.Codec) *cobra.Command { 31 return &cobra.Command{ 32 Use: "show <username>", 33 Short: "show <username>", 34 Args: cobra.ExactArgs(1), 35 RunE: func(cmd *cobra.Command, args []string) error { 36 username := args[0] 37 uri := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, types.QueryReputation, username) 38 rst := linotypes.MiniDollar{} 39 return utils.CLIQueryJSONPrint(cdc, uri, nil, 40 func() interface{} { return &rst }) 41 }, 42 } 43 }