Bump clap to v4.0.2 (#450)

* Rm unused dep clap from crate `binstalk`
* Bump clap to v4.0.2

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-09-29 13:14:00 +10:00 committed by GitHub
parent 111bfde2cb
commit aa864fad59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 50 deletions

15
Cargo.lock generated
View file

@ -114,7 +114,6 @@ dependencies = [
"bytes",
"bzip2",
"cargo_toml",
"clap",
"compact_str",
"crates_io_api",
"detect-targets",
@ -316,26 +315,24 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.22"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
checksum = "31c9484ccdc4cb8e7b117cbd0eb150c7c0f04464854e4679aeb50ef03b32d003"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_derive"
version = "3.2.18"
version = "4.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
checksum = "ca689d7434ce44517a12a89456b2be4d1ea1cafcd8f581978c03d45f5a5c12a7"
dependencies = [
"heck",
"proc-macro-error",
@ -346,9 +343,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.2.4"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]

View file

@ -23,7 +23,7 @@ pkg-fmt = "zip"
[dependencies]
binstalk = { path = "../binstalk", version = "0.3.0" }
clap = { version = "3.2.22", features = ["derive"] }
clap = { version = "4.0.2", features = ["derive"] }
crates_io_api = { version = "0.8.1", default-features = false }
dirs = "4.0.0"
log = "0.4.17"

View file

@ -5,13 +5,19 @@ use binstalk::{
manifests::cargo_toml_binstall::PkgFmt,
ops::resolve::{CrateName, VersionReqExt},
};
use clap::{builder::PossibleValue, AppSettings, ArgEnum, Parser};
use clap::{Parser, ValueEnum};
use log::LevelFilter;
use reqwest::tls::Version;
use semver::VersionReq;
#[derive(Debug, Parser)]
#[clap(version, about = "Install a Rust binary... from binaries!", setting = AppSettings::ArgRequiredElseHelp)]
#[clap(
version,
about = "Install a Rust binary... from binaries!",
arg_required_else_help(true),
// Avoid conflict with version_req
disable_version_flag(true),
)]
pub struct Args {
/// Packages to install.
///
@ -39,7 +45,11 @@ pub struct Args {
///
/// Cannot be used when multiple packages are installed at once, use the attached version
/// syntax in that case.
#[clap(help_heading = "Package selection", long = "version", parse(try_from_str = VersionReq::parse_from_cli))]
#[clap(
help_heading = "Package selection",
long = "version",
value_parser(VersionReq::parse_from_cli)
)]
pub version_req: Option<VersionReq>,
/// Override binary target set.
@ -76,7 +86,7 @@ pub struct Args {
/// Override Cargo.toml package manifest pkg-fmt.
///
/// The availiable package formats are:
/// The available package formats are:
///
/// - tar: download format is TAR (uncompressed)
///
@ -91,22 +101,7 @@ pub struct Args {
/// - zip: Download format is Zip
///
/// - bin: Download format is raw / binary
#[clap(
help_heading = "Overrides",
long,
value_name = "PKG_FMT",
possible_values = [
PossibleValue::new("tar").help(
"Download format is TAR (uncompressed)."
),
PossibleValue::new("tbz2").help("Download format is TAR + Bzip2."),
PossibleValue::new("tgz").help("Download format is TGZ (TAR + GZip)."),
PossibleValue::new("txz").help("Download format is TAR + XZ."),
PossibleValue::new("tzstd").help("Download format is TAR + Zstd."),
PossibleValue::new("zip").help("Download format is Zip."),
PossibleValue::new("bin").help("Download format is raw / binary."),
]
)]
#[clap(help_heading = "Overrides", long, value_name = "PKG_FMT")]
pub pkg_fmt: Option<PkgFmt>,
/// Override Cargo.toml package manifest pkg-url.
@ -169,13 +164,9 @@ pub struct Args {
///
/// The default is not to require any minimum TLS version, and use the negotiated highest
/// version available to both this client and the remote server.
#[clap(help_heading = "Options", long, arg_enum, value_name = "VERSION")]
#[clap(help_heading = "Options", long, value_enum, value_name = "VERSION")]
pub min_tls_version: Option<TLSVersion>,
/// Print help information
#[clap(help_heading = "Meta", short, long)]
pub help: bool,
/// Print version information
#[clap(help_heading = "Meta", short = 'V')]
pub version: bool,
@ -199,19 +190,7 @@ pub struct Args {
help_heading = "Meta",
long,
default_value = "info",
value_name = "LEVEL",
possible_values = [
PossibleValue::new("trace").help(
"Set to `trace` to print very low priority, often extremely verbose information."
),
PossibleValue::new("debug").help("Set to debug when submitting a bug report."),
PossibleValue::new("info").help("Set to info to only print useful information."),
PossibleValue::new("warn").help("Set to warn to only print on hazardous situations."),
PossibleValue::new("error").help("Set to error to only print serious errors."),
PossibleValue::new("off").help(
"Set to off to disable logging completely, this will also disable output from `cargo-install`."
),
]
value_name = "LEVEL"
)]
pub log_level: LevelFilter,
@ -222,7 +201,7 @@ pub struct Args {
pub quiet: bool,
}
#[derive(Debug, Copy, Clone, ArgEnum)]
#[derive(Debug, Copy, Clone, ValueEnum)]
pub enum TLSVersion {
#[clap(name = "1.2")]
Tls1_2,

View file

@ -14,7 +14,6 @@ async-trait = "0.1.57"
bytes = "1.2.1"
bzip2 = "0.4.3"
cargo_toml = "0.12.2"
clap = { version = "4.0.2", features = ["derive"] }
compact_str = { version = "0.6.0", features = ["serde"] }
crates_io_api = { version = "0.8.1", default-features = false }
detect-targets = { version = "0.1.2", path = "../detect-targets" }