Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: CLI Response Formatting #3301

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Linter errors
  • Loading branch information
jackzampolin committed Jan 15, 2019
commit 4fd016363bdd4ee4c35d85e49d6b8b5572e0d0cb
4 changes: 2 additions & 2 deletions x/gov/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {
var votingParams gov.VotingParams
cdc.MustUnmarshalJSON(vp, &votingParams)

client.PrintOutput(cdc, gov.NewGovParams(votingParams, tallyParams, depositParams))
client.PrintOutput(cdc, gov.NewParams(votingParams, tallyParams, depositParams))
return nil
},
}
Expand Down Expand Up @@ -469,7 +469,7 @@ func GetCmdQueryParam(queryRoute string, cdc *codec.Codec) *cobra.Command {
cdc.MustUnmarshalJSON(res, &param)
out = param
default:
return fmt.Errorf("Arguement must be one of (voting|tallying|deposit), was %s", args[0])
return fmt.Errorf("Argument must be one of (voting|tallying|deposit), was %s", args[0])
}

client.PrintOutput(cdc, out)
Expand Down
10 changes: 5 additions & 5 deletions x/gov/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ func (vp VotingParams) String() string {
Voting Period: %s`, vp.VotingPeriod)
}

// GovParams returns all of the governance params
type GovParams struct {
// Params returns all of the governance params
type Params struct {
VotingParams VotingParams `json:"voting_params"`
TallyParams TallyParams `json:"tally_params"`
DepositParams DepositParams `json:"deposit_params"`
}

func (gp GovParams) String() string {
func (gp Params) String() string {
return gp.VotingParams.String() + "\n" +
gp.TallyParams.String() + "\n" + gp.DepositParams.String()
}

func NewGovParams(vp VotingParams, tp TallyParams, dp DepositParams) GovParams {
return GovParams{
func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params {
return Params{
VotingParams: vp,
DepositParams: dp,
TallyParams: tp,
Expand Down