generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(logic): re-introduce descriptor for CLI (lost with migration)
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package logic | ||
|
||
import ( | ||
"fmt" | ||
|
||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" | ||
|
||
"github.com/cosmos/cosmos-sdk/version" | ||
|
||
"github.com/okp4/okp4d/x/logic/types" | ||
) | ||
|
||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface for the logic module. | ||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { | ||
return &autocliv1.ModuleOptions{ | ||
Query: &autocliv1.ServiceCommandDescriptor{ | ||
Service: types.GrpcQueryServiceDesc().ServiceName, | ||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{ | ||
{ | ||
RpcMethod: "Ask", | ||
Use: "ask [query]", | ||
Short: "Executes a logic query and returns the solution(s) found.", | ||
Long: `Executes the [query] and return the solution(s) found. | ||
Optionally, a program can be transmitted, which will be compiled before the query is processed. | ||
Since the query is without any side-effect, the query is not executed in the context of a transaction and no fee | ||
is charged for this, but the execution is constrained by the current limits configured in the module (that you can | ||
query).`, | ||
Example: fmt.Sprintf(`$ %s query %s ask "chain_id(X)." # returns the chain-id`, | ||
version.AppName, | ||
types.ModuleName), | ||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "query"}}, | ||
FlagOptions: map[string]*autocliv1.FlagOptions{ | ||
"program": { | ||
Shorthand: "p", | ||
Usage: "The program to compile before the query.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,10 @@ | ||
package types | ||
|
||
import "google.golang.org/grpc" | ||
|
||
// GrpcQueryServiceDesc represents the query server's RPC service specification. | ||
// This gives access to the service name and method names needed for stargate | ||
// queries. | ||
func GrpcQueryServiceDesc() grpc.ServiceDesc { | ||
return _QueryService_serviceDesc | ||
} |