From a1b257d91677637063c1eb359097d53078f7272a Mon Sep 17 00:00:00 2001 From: Michel Salim Date: Wed, 2 Aug 2023 12:19:57 -0700 Subject: [PATCH] migrate to Clap 4 Summary: Two `below` crates currently still use Clap 3; update to 4. This unblocks updating below in Fedora which has dropped clap 3 from its repos. Reviewed By: brianc118 Differential Revision: D48002223 fbshipit-source-id: 5f4d02fced4f182098b3ee7627b0af3179d9addb --- below/Cargo.toml | 4 ++-- below/dump/Cargo.toml | 2 +- below/dump/src/command.rs | 14 +++++++------- below/src/main.rs | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/below/src/main.rs b/below/src/main.rs index 0cf70e53..0a0aa57f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,7 +77,7 @@ static LIVE_REMOTE_MAX_LATENCY_SEC: u64 = 10; #[derive(Debug, Parser)] struct Opt { - #[clap(long, parse(from_os_str), default_value = config::BELOW_DEFAULT_CONF)] + #[clap(long, value_parser, default_value = config::BELOW_DEFAULT_CONF)] config: PathBuf, #[clap(short, long)] debug: bool, @@ -104,7 +104,7 @@ struct CompressOpts { /// /// With --dict-compress-chunk-size 16, you can expect around /// 20-30x smaller data files. - #[clap(long, requires("compress"), parse(try_from_str = parse_chunk_size))] + #[clap(long, requires("compress"), value_parser = parse_chunk_size)] dict_compress_chunk_size: Option, } @@ -267,7 +267,7 @@ enum Command { duration: Option, /// Output file path. /// Randomized name in current directory if unspecified. - #[clap(short, long, parse(from_os_str))] + #[clap(short, long, value_parser)] output: Option, /// Supply hostname to take snapshot from remote #[clap(short = 's', long)] @@ -283,7 +283,7 @@ enum Command { #[clap(short, long, default_value = "bash")] shell: Shell, /// Output file, stdout if not present - #[clap(short, long, parse(from_os_str))] + #[clap(short, long, value_parser)] output: Option, }, }