Merge PR #6765: x/auth: Finish CLI Refactor
This commit is contained in:
@@ -9,13 +9,11 @@ import (
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
)
|
||||
@@ -23,12 +21,14 @@ import (
|
||||
// TODO these next two functions feel kinda hacky based on their placement
|
||||
|
||||
//ValidatorCommand returns the validator set for a given height
|
||||
func ValidatorCommand(cdc *codec.Codec) *cobra.Command {
|
||||
func ValidatorCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "tendermint-validator-set [height]",
|
||||
Short: "Get the full tendermint validator set at given height",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
|
||||
var height *int64
|
||||
|
||||
// optional height
|
||||
@@ -43,9 +43,10 @@ func ValidatorCommand(cdc *codec.Codec) *cobra.Command {
|
||||
}
|
||||
}
|
||||
|
||||
clientCtx := client.NewContext().WithCodec(cdc)
|
||||
page, _ := cmd.Flags().GetInt(flags.FlagPage)
|
||||
limit, _ := cmd.Flags().GetInt(flags.FlagLimit)
|
||||
|
||||
result, err := GetValidators(clientCtx, height, viper.GetInt(flags.FlagPage), viper.GetInt(flags.FlagLimit))
|
||||
result, err := GetValidators(clientCtx, height, page, limit)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -55,19 +56,10 @@ func ValidatorCommand(cdc *codec.Codec) *cobra.Command {
|
||||
}
|
||||
|
||||
cmd.Flags().StringP(flags.FlagNode, "n", "tcp://localhost:26657", "Node to connect to")
|
||||
viper.BindPFlag(flags.FlagNode, cmd.Flags().Lookup(flags.FlagNode))
|
||||
|
||||
cmd.Flags().Bool(flags.FlagTrustNode, false, "Trust connected full node (don't verify proofs for responses)")
|
||||
viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
|
||||
|
||||
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
|
||||
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
|
||||
|
||||
cmd.Flags().Int(flags.FlagPage, 0, "Query a specific page of paginated results")
|
||||
viper.BindPFlag(flags.FlagPage, cmd.Flags().Lookup(flags.FlagPage))
|
||||
|
||||
cmd.Flags().Int(flags.FlagLimit, 100, "Query number of results returned per page")
|
||||
viper.BindPFlag(flags.FlagLimit, cmd.Flags().Lookup(flags.FlagLimit))
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user