feat: add basic autocli config to every module (#13786)

* feat: add autocli configs to every module

* auto-discover config

* tests + gov, auth config tweaks

* docs

* Update x/auth/autocli.go

Co-authored-by: Julien Robert <julien@rbrt.fr>

* Update x/auth/autocli.go

Co-authored-by: Julien Robert <julien@rbrt.fr>

* cleanup

Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
Aaron Craelius
2022-11-09 11:44:42 +00:00
committed by GitHub
co-authored by Julien Robert Amaury
parent 4f7d9ea233
commit bcdf81cbaf
7 changed files with 131 additions and 34 deletions
+15 -2
View File
@@ -127,8 +127,21 @@ func TestQueryAutoCLIAppOptions(t *testing.T) {
assert.NilError(t, err)
assert.Assert(t, res != nil && res.ModuleOptions != nil)
// make sure we at least have x/auth autocli options
// make sure we have x/auth autocli options which were configured manually
authOpts := res.ModuleOptions["auth"]
assert.Assert(t, authOpts != nil)
assert.Assert(t, authOpts.Query != nil && authOpts.Query.Service != "")
assert.Assert(t, authOpts.Query != nil)
assert.Equal(t, "cosmos.auth.v1beta1.Query", authOpts.Query.Service)
// make sure we have some custom options
assert.Assert(t, len(authOpts.Query.RpcCommandOptions) != 0)
// make sure we have x/staking autocli options which should have been auto-discovered
stakingOpts := res.ModuleOptions["staking"]
assert.Assert(t, stakingOpts != nil)
assert.Assert(t, stakingOpts.Query != nil && stakingOpts.Tx != nil)
assert.Equal(t, "cosmos.staking.v1beta1.Query", stakingOpts.Query.Service)
assert.Equal(t, "cosmos.staking.v1beta1.Msg", stakingOpts.Tx.Service)
// make sure tx module has no autocli options because it has no services
assert.Assert(t, res.ModuleOptions["tx"] == nil)
}