-
Notifications
You must be signed in to change notification settings - Fork 378
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
Update to clap 4 #1253
Update to clap 4 #1253
Conversation
Great, thanks for this work @tjquillan. I'll look forward to the final version. |
@dandavison If possible I could use your input on an issue I am encountering. It seems as of pub fn get_argument_and_option_names<'a>() -> HashMap<&'a str, &'a str> {
itertools::chain(Self::command().get_opts(), Self::command().get_arguments())
.filter_map(|arg| match (arg.get_id(), arg.get_long()) {
(name, Some(long)) => {
if IGNORED_OPTION_NAMES.contains(name.as_str()) {
None
} else {
Some((name.as_str(), long))
}
}
_ => None,
})
.collect()
}
I am very much new to rust so I don't exactly know what a solution to this would look like (it is very possible the answer is obvious to an experienced rust programmer). An alternative I see would be to change the HashMap to |
From some looking I wonder if clap-rs/clap#4103 and clap-rs/clap#4223 might be related. Relevant changelog: |
Thanks very much for this work @tjquillan. Your commits were included in @nickelc's work #1322 which has merged. |
This updates delta to
clap
version4.0.29
. With all the migrations that come along with it. I am leaving this as a draft for now as I still need to make the correct updates to the code. I will list the changes and important parts of4.0.0
here as I go. I will try to do each change as a single commit so they can be dropped or changed as needed.Changes:
help,usage,error-context
default-features = false
, runcargo add clap -F help,usage,error-context
wrap_help
cargo add clap -F wrap_help
unless you want to hard code line wrapsDeriveDisplayOrder
as it is now the defaultDeriveDisplayOrder
the default and removed the setting.ValueSource
using statementclap::{Indices, OsValues, ValueSource, Values}
toclap::parser::{Indices, OsValues, ValueSource, Values}
#[clap(...)]
to#[command(...)]
where appropriate#[clap(...)]
has been deprecated in favor of#[command(...)]
#[clap(...)]
to#[arg(...)]
where appropriate#[clap(...)]
has been deprecated in favor of#[arg(...)]
#[structopt(...)]
to#[arg(...)]
where appropriate#[structopt(...)]
has been deprecated in favor of#[arg(...)]
value_parser
because it is now defaultparse
tovalue_parser