-
Notifications
You must be signed in to change notification settings - Fork 175
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 warnings while using common arguments #2573
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 67d2f14.
Co-authored-by: Franciszek Job <[email protected]>
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.
LGTM
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.
For this to make sense, it should also already be possible to pass these arguments in the subcommands we are relocating them to. Because right now, it's impossible to avoid having these warnings displayed.
What I'd like is if for example someone does this
sncast --account my_account invoke ...
It should show a warning, but it should already be possible to do
sncast invoke --account my_account
And not get shown a warning.
@@ -66,21 +67,21 @@ Report bugs: https://github.com/foundry-rs/starknet-foundry/issues/new/choose\ | |||
#[allow(clippy::struct_excessive_bools)] | |||
struct Cli { | |||
/// Profile name in snfoundry.toml config file | |||
#[clap(short, long)] | |||
#[clap(short, long, global = true)] |
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.
Instead of making these arguments global, let's actually add them as arguments to subcommands that use them. And keep them as global as well to retain current cli.
If a user uses the global version show a warning but continue program execution.
If both are provided, throw an error.
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.
Tip: I think could use this https://docs.rs/clap/4.5.20/clap/struct.Arg.html#method.value_parser, log a waring in custom parser and then parse with standard clap parser https://docs.rs/clap/4.5.20/clap/macro.value_parser.html
(thought about it for whole 30 s, so don't take it as granted)
Relates #2552
Introduced changes
Checklist
CHANGELOG.md