-
Notifications
You must be signed in to change notification settings - Fork 111
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
add macros to generate clap commands and args for modules in runtime #423
Conversation
module-system/module-implementations/examples/sov-election/src/call.rs
Outdated
Show resolved
Hide resolved
module-system/module-implementations/examples/sov-value-setter/Cargo.toml
Outdated
Show resolved
Hide resolved
Thanks for the work! The module system now makes I understand this might be bigger chunk of work (and a will require some research) so I am fine with merging the PR, but I would like to discuss the intermediate structures approach on the daily. |
module-system/module-implementations/examples/sov-election/Cargo.toml
Outdated
Show resolved
Hide resolved
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, Preston! I had a couple of old comments about introducing thiserror: https://github.com/Sovereign-Labs/sovereign-sdk/pull/423/files#r1238171744. I think you have mentioned there were some problems with doing this way, right? If this is the case, feel free to close them.
…423) * module clap cli draft pr * temp commit working state * add impls for other fields of Runtime * working code * fix broken test * fix cargo hack * missing file * fix linting * lint fix * WIP: continue cleanup * Use anyhow::Error as FromStr error * Rustc panics here * Fix bug in cli_parser bounds extraction * It works * Fix warnings/lints * Defer serde bounds enforcement * Remove even more deserialize bounds * Update CLI with inline tx generation * Fix doc test; improve hygiene * cleanup; make hex optional * remove duplicate Signature defn * Fix unused import * remove evm cli for now * fix warnings without default features * Fix unused import * Fix evm skipping * Fix formatting * Fix bug in cli make batch * Get cli_skip working * Convert to derive macro * derive CliWalletArg for structs * Fix doc tests * test cli_wallet_arg derive * revert lockfile * Remove lockfile from git * lint * Add missing cfg_attr * Remove commented code * fix doc test * Address code review feedback --------- Co-authored-by: dubbelosix <[email protected]> Co-authored-by: Preston Evans <[email protected]>
Description
We currently let the users use sov-cli by passing in a json file that contains a json representation of the CallMessage
where
src/sov-cli/test_data/create_token.json
isThis PR adds an additional command to the sov-cli called
generate-transaction
, which allows the arguments to be specified on the command line.The generated cli will have documentation based on doc comments in the CallMessage enum for each module:
Updates July 20 (by @preston-evans98)
This PR has been significantly refactored to address a number of limitations. Now, the
cli_parser
macro no longer requires theContext
type to be provided as part of the annotation. Instead, the cli methods are generated generically so that any context can be configured in the resulting binary.Remaining work:
clap
dependency behindsov_modules_api
cli_parser
as aderive
macro instead of an attributecli_skip
to be an attribute instead of an arg tocli_parser
clap::Parser
for structs and standard enums behind ourCliWalletArg
macroLinked Issues
sov-cli
improvements #552Testing
Tested using
try_build
Docs
Doc comments have been added as appropriate.