planetmint-go/x/dao/client/cli/query_params.go
Julian Strobl bead62bd04
refactor(query): align with cosmos-sdk style (#466)
- use one `cmd.AddCommand(...)`
- sort commands
- use `GetCmd...` function name style

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-12 15:59:52 +01:00

37 lines
763 B
Go

package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "Query the current dao parameters information",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}