-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> * Update x/auth/autocli.go Co-authored-by: Julien Robert <[email protected]> * cleanup Co-authored-by: Julien Robert <[email protected]> Co-authored-by: Amaury <[email protected]>
- Loading branch information
1 parent
4f7d9ea
commit bcdf81c
Showing
7 changed files
with
131 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package auth | ||
|
||
import ( | ||
authv1beta1 "cosmossdk.io/api/cosmos/auth/v1beta1" | ||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" | ||
) | ||
|
||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. | ||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { | ||
return &autocliv1.ModuleOptions{ | ||
Query: &autocliv1.ServiceCommandDescriptor{ | ||
Service: authv1beta1.Query_ServiceDesc.ServiceName, | ||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{ | ||
{ | ||
RpcMethod: "Account", | ||
Use: "account [address]", | ||
Short: "query account by address", | ||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, | ||
}, | ||
{ | ||
RpcMethod: "AccountAddressByID", | ||
Use: "address-by-id [acc-num]", | ||
Short: "query account address by account number", | ||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}}, | ||
}, | ||
}, | ||
}, | ||
Tx: &autocliv1.ServiceCommandDescriptor{ | ||
Service: authv1beta1.Msg_ServiceDesc.ServiceName, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package gov | ||
|
||
import ( | ||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" | ||
govv1 "cosmossdk.io/api/cosmos/gov/v1" | ||
govv1beta1 "cosmossdk.io/api/cosmos/gov/v1beta1" | ||
) | ||
|
||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. | ||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { | ||
return &autocliv1.ModuleOptions{ | ||
Tx: &autocliv1.ServiceCommandDescriptor{ | ||
Service: govv1.Msg_ServiceDesc.ServiceName, | ||
// map v1beta1 as a sub-command | ||
SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ | ||
"v1beta1": {Service: govv1beta1.Msg_ServiceDesc.ServiceName}, | ||
}, | ||
}, | ||
Query: &autocliv1.ServiceCommandDescriptor{ | ||
Service: govv1.Query_ServiceDesc.ServiceName, | ||
// map v1beta1 as a sub-command | ||
SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ | ||
"v1beta1": {Service: govv1beta1.Query_ServiceDesc.ServiceName}, | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters