Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/config.rs @ 49758:37bc3edef76f
rhg: upgrade `clap` dependency
This one is the worst one to upgrade since v2 -> v4 broke a ton of API,
which thankfully seems saner now.
Contrary to what was done in the `hg-core/src/examples/nodemap` rewrite,
we're not switching from the "builder" pattern to the "derive" pattern,
since that would imply a much larger diff. It can be done incrementally.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 15 Nov 2022 00:02:43 +0100 |
parents | b1e6265e8336 |
children | 94e2547e6f3d |
line wrap: on
line diff
--- a/rust/rhg/src/commands/config.rs Mon Nov 14 17:18:56 2022 +0100 +++ b/rust/rhg/src/commands/config.rs Tue Nov 15 00:02:43 2022 +0100 @@ -8,14 +8,13 @@ With one argument of the form section.name, print just the value of that config item. "; -pub fn args() -> clap::App<'static, 'static> { - clap::SubCommand::with_name("config") +pub fn args() -> clap::Command { + clap::command!("config") .arg( - Arg::with_name("name") + Arg::new("name") .help("the section.name to print") .value_name("NAME") - .required(true) - .takes_value(true), + .required(true), ) .about(HELP_TEXT) } @@ -23,7 +22,7 @@ pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { let (section, name) = invocation .subcommand_args - .value_of("name") + .get_one::<String>("name") .expect("missing required CLI argument") .as_bytes() .split_2(b'.')