diff --git a/x/bank/client/cli/query.go b/x/bank/client/cli/query.go index d34e7f3c7013..95c070abd7f2 100644 --- a/x/bank/client/cli/query.go +++ b/x/bank/client/cli/query.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -73,7 +72,7 @@ Example: return err } - pageReq := &query.PageRequest{} + pageReq := client.ReadPageRequest(cmd.Flags()) if denom == "" { params := types.NewQueryAllBalancesRequest(addr, pageReq) @@ -96,6 +95,7 @@ Example: cmd.Flags().String(FlagDenom, "", "The specific balance denomination to query for") flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "all balances") return cmd } diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 413029abafab..0538345825c9 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -315,7 +315,7 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 } // Deprecated, remove line when removing FlagPage altogether. - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of proposals to to query for") + cmd.Flags().Int(flags.FlagPage, 1, "pagination page of proposals to query for") flags.AddPaginationFlagsToCmd(cmd, "votes") flags.AddQueryFlagsToCmd(cmd) diff --git a/x/ibc/02-client/client/cli/query.go b/x/ibc/02-client/client/cli/query.go index 83ce8a4864f8..17fb9e7e8537 100644 --- a/x/ibc/02-client/client/cli/query.go +++ b/x/ibc/02-client/client/cli/query.go @@ -45,7 +45,7 @@ func GetCmdQueryClientStates() *cobra.Command { }, } - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to to query for") + cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to query for") cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of light clients to query for") flags.AddQueryFlagsToCmd(cmd) diff --git a/x/ibc/03-connection/client/cli/query.go b/x/ibc/03-connection/client/cli/query.go index d25eb8cea74e..c0cc5d47b4e7 100644 --- a/x/ibc/03-connection/client/cli/query.go +++ b/x/ibc/03-connection/client/cli/query.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/client/utils" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" @@ -33,14 +32,8 @@ func GetCmdQueryConnections() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - offset, _ := cmd.Flags().GetInt(flags.FlagPage) - limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - req := &types.QueryConnectionsRequest{ - Pagination: &query.PageRequest{ - Offset: uint64(offset), - Limit: uint64(limit), - }, + Pagination: client.ReadPageRequest(cmd.Flags()), } res, err := queryClient.Connections(context.Background(), req) @@ -52,9 +45,8 @@ func GetCmdQueryConnections() *cobra.Command { }, } - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to to query for") - cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of light clients to query for") flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "connection ends") return cmd } diff --git a/x/ibc/04-channel/client/cli/query.go b/x/ibc/04-channel/client/cli/query.go index 5bf57cd90a7c..1cdb6a341fa4 100644 --- a/x/ibc/04-channel/client/cli/query.go +++ b/x/ibc/04-channel/client/cli/query.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/client/utils" "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" @@ -38,14 +37,8 @@ func GetCmdQueryChannels() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - offset, _ := cmd.Flags().GetInt(flags.FlagPage) - limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - req := &types.QueryChannelsRequest{ - Pagination: &query.PageRequest{ - Offset: uint64(offset), - Limit: uint64(limit), - }, + Pagination: client.ReadPageRequest(cmd.Flags()), } res, err := queryClient.Channels(context.Background(), req) @@ -58,9 +51,8 @@ func GetCmdQueryChannels() *cobra.Command { }, } - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to to query for") - cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of light clients to query for") flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "channels") return cmd } @@ -119,15 +111,9 @@ func GetCmdQueryConnectionChannels() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - offset, _ := cmd.Flags().GetInt(flags.FlagPage) - limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - req := &types.QueryConnectionChannelsRequest{ Connection: args[0], - Pagination: &query.PageRequest{ - Offset: uint64(offset), - Limit: uint64(limit), - }, + Pagination: client.ReadPageRequest(cmd.Flags()), } res, err := queryClient.ConnectionChannels(context.Background(), req) @@ -140,9 +126,8 @@ func GetCmdQueryConnectionChannels() *cobra.Command { }, } - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to to query for") - cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of light clients to query for") flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "channels associated with a connection") return cmd } @@ -197,16 +182,10 @@ func GetCmdQueryPacketCommitments() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - offset, _ := cmd.Flags().GetInt(flags.FlagPage) - limit, _ := cmd.Flags().GetInt(flags.FlagLimit) - req := &types.QueryPacketCommitmentsRequest{ - PortID: args[0], - ChannelID: args[1], - Pagination: &query.PageRequest{ - Offset: uint64(offset), - Limit: uint64(limit), - }, + PortID: args[0], + ChannelID: args[1], + Pagination: client.ReadPageRequest(cmd.Flags()), } res, err := queryClient.PacketCommitments(context.Background(), req) @@ -219,9 +198,8 @@ func GetCmdQueryPacketCommitments() *cobra.Command { }, } - cmd.Flags().Int(flags.FlagPage, 1, "pagination page of light clients to to query for") - cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of light clients to query for") flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "packet commitments associated with a channel") return cmd }