-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Avoid new deprecation warnings from clap 3.1.0 #10396
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ pub use crate::core::compiler::CompileMode; | |
pub use crate::{CliError, CliResult, Config}; | ||
pub use clap::{AppSettings, Arg, ArgMatches}; | ||
|
||
pub type App = clap::App<'static>; | ||
pub type App = clap::Command<'static>; | ||
|
||
pub trait AppExt: Sized { | ||
fn _arg(self, arg: Arg<'static>) -> Self; | ||
|
@@ -281,7 +281,9 @@ pub fn multi_opt(name: &'static str, value_name: &'static str, help: &'static st | |
} | ||
|
||
pub fn subcommand(name: &'static str) -> App { | ||
App::new(name).setting(AppSettings::DeriveDisplayOrder | AppSettings::DontCollapseArgsInUsage) | ||
App::new(name) | ||
.dont_collapse_args_in_usage(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI this became a If that is a concern, you can still use the When we made this global, it was under the assumption people would want a uniform look. If this assumption is incorrect, we can open an issue and re-visit this in clap v4. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, interesting. I honestly couldn't tell you whether that change is okay or not. I feel like it probably is since we're seemingly applying it to all subcommands, but others who know the CLI interface better may need to weigh in here. |
||
.setting(AppSettings::DeriveDisplayOrder) | ||
} | ||
|
||
/// Determines whether or not to gate `--profile` as unstable when resolving it. | ||
|
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.
Clap feature request: this would be better as:
where the signature is:
It seems clumsy that to access the piece of context you want requires iterating arbitrary other context kinds and having to assert that clap didn't stick your context in there with a type that it wasn't supposed to.
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.
Yeah, this code made me really sad to write.
The proposed interface may have to be able to deal with multiple values for a given kind, I'm not sure, but worth thinking about for sure 👍
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.
I started with the most general API, awaiting seeing how it was going to be used to know what would be helpful.
Since
fn context()
is already in use, we'll just have to come up with a different name for this.