cli: refactor flag reading (#6884)

* cli: refactor ReadPersistentCommandFlags

* updates

* fix tetts

* cover all cases

* fix tests

* fix tests

* fix tests

* fix tests

* godoc++

Co-authored-by: Aaron Craelius <aaron@regen.network>
This commit is contained in:
Alexander Bezobchuk
2020-07-30 16:44:22 +00:00
committed by GitHub
co-authored by Aaron Craelius
parent eb08781e8a
commit 9ccec075e2
7 changed files with 119 additions and 74 deletions
+6 -6
View File
@@ -66,8 +66,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
expectedOutput string
}{
{
"default output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight)},
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`{"mint_denom":"stake","inflation_rate_change":"0.130000000000000000","inflation_max":"1.000000000000000000","inflation_min":"1.000000000000000000","goal_bonded":"0.670000000000000000","blocks_per_year":"6311520"}`,
},
{
@@ -112,8 +112,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryInflation() {
expectedOutput string
}{
{
"default output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight)},
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`"1.000000000000000000"`,
},
{
@@ -153,8 +153,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() {
expectedOutput string
}{
{
"default output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight)},
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`"500000000.000000000000000000"`,
},
{