mirror of https://github.com/sharkdp/fd.git
Merge pull request #1244 from tmccombs/grouped-occurrences
update: Update to clap 4.1
This commit is contained in:
commit
73a693ef28
|
@ -1,7 +1,7 @@
|
|||
name: CICD
|
||||
|
||||
env:
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.60.0"
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.64.0"
|
||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||
|
||||
on:
|
||||
|
|
|
@ -101,14 +101,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.0.22"
|
||||
version = "4.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91b9970d7505127a162fdaa9b96428d28a479ba78c9ec7550a63a5d9863db682"
|
||||
checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"is-terminal",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
|
@ -126,9 +126,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.0.21"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
|
||||
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
|
@ -473,6 +473,28 @@ version = "0.7.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0"
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
|
||||
dependencies = [
|
||||
"hermit-abi 0.2.6",
|
||||
"io-lifetimes 1.0.4",
|
||||
"rustix 0.36.6",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jemalloc-sys"
|
||||
version = "0.5.2+5.3.0-patched"
|
||||
|
@ -530,6 +552,12 @@ version = "0.0.46"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
|
@ -751,12 +779,26 @@ checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"io-lifetimes 0.7.4",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"linux-raw-sys 0.0.46",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes 1.0.4",
|
||||
"libc",
|
||||
"linux-raw-sys 0.1.4",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
|
@ -824,7 +866,7 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8440c860cf79def6164e4a0a983bcc2305d82419177a0e0c71930d049e3ac5a1"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"rustix 0.35.12",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ readme = "README.md"
|
|||
repository = "https://github.com/sharkdp/fd"
|
||||
version = "8.6.0"
|
||||
edition= "2021"
|
||||
rust-version = "1.64.0"
|
||||
|
||||
[badges.appveyor]
|
||||
repository = "sharkdp/fd"
|
||||
|
@ -52,7 +53,7 @@ clap_complete = {version = "4.0.6", optional = true}
|
|||
faccess = "0.2.4"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "4.0.22"
|
||||
version = "4.1.1"
|
||||
features = ["suggestions", "color", "wrap_help", "cargo", "unstable-grouped", "derive"]
|
||||
|
||||
[dependencies.chrono]
|
||||
|
|
2
build.rs
2
build.rs
|
@ -1,5 +1,5 @@
|
|||
fn main() {
|
||||
let min_version = "1.60";
|
||||
let min_version = "1.64";
|
||||
|
||||
match version_check::is_min_version(min_version) {
|
||||
Some(true) => {}
|
||||
|
|
|
@ -1 +1 @@
|
|||
msrv = "1.60.0"
|
||||
msrv = "1.64.0"
|
||||
|
|
|
@ -760,11 +760,11 @@ pub struct Exec {
|
|||
impl clap::FromArgMatches for Exec {
|
||||
fn from_arg_matches(matches: &ArgMatches) -> clap::error::Result<Self> {
|
||||
let command = matches
|
||||
.grouped_values_of("exec")
|
||||
.get_occurrences::<String>("exec")
|
||||
.map(CommandSet::new)
|
||||
.or_else(|| {
|
||||
matches
|
||||
.grouped_values_of("exec_batch")
|
||||
.get_occurrences::<String>("exec_batch")
|
||||
.map(CommandSet::new_batch)
|
||||
})
|
||||
.transpose()
|
||||
|
|
|
@ -39,9 +39,10 @@ pub struct CommandSet {
|
|||
}
|
||||
|
||||
impl CommandSet {
|
||||
pub fn new<I, S>(input: I) -> Result<CommandSet>
|
||||
pub fn new<I, T, S>(input: I) -> Result<CommandSet>
|
||||
where
|
||||
I: IntoIterator<Item = Vec<S>>,
|
||||
I: IntoIterator<Item = T>,
|
||||
T: IntoIterator<Item = S>,
|
||||
S: AsRef<str>,
|
||||
{
|
||||
Ok(CommandSet {
|
||||
|
@ -53,9 +54,10 @@ impl CommandSet {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn new_batch<I, S>(input: I) -> Result<CommandSet>
|
||||
pub fn new_batch<I, T, S>(input: I) -> Result<CommandSet>
|
||||
where
|
||||
I: IntoIterator<Item = Vec<S>>,
|
||||
I: IntoIterator<Item = T>,
|
||||
T: IntoIterator<Item = S>,
|
||||
S: AsRef<str>,
|
||||
{
|
||||
Ok(CommandSet {
|
||||
|
|
|
@ -1805,18 +1805,26 @@ fn test_exec_batch() {
|
|||
\n\
|
||||
Usage: fd [OPTIONS] [pattern] [path]...\n\
|
||||
\n\
|
||||
For more information try '--help'\n\
|
||||
For more information, try '--help'.\n\
|
||||
",
|
||||
);
|
||||
|
||||
te.assert_failure_with_error(
|
||||
&["foo", "--exec-batch", "echo", "{/}", ";", "-x", "echo"],
|
||||
"error: The argument '--exec-batch <cmd>...' cannot be used with '--exec <cmd>...'",
|
||||
"error: the argument '--exec-batch <cmd>...' cannot be used with '--exec <cmd>...'\n\
|
||||
\n\
|
||||
Usage: fd --exec-batch <cmd>... <pattern> [path]...\n\
|
||||
\n\
|
||||
For more information, try '--help'.\n\
|
||||
",
|
||||
);
|
||||
|
||||
te.assert_failure_with_error(
|
||||
&["foo", "--exec-batch"],
|
||||
"error: The argument '--exec-batch <cmd>...' requires a value but none was supplied",
|
||||
"error: a value is required for '--exec-batch <cmd>...' but none was supplied\n\
|
||||
\n\
|
||||
For more information, try '--help'.\n\
|
||||
",
|
||||
);
|
||||
|
||||
te.assert_failure_with_error(
|
||||
|
@ -1825,7 +1833,7 @@ fn test_exec_batch() {
|
|||
\n\
|
||||
Usage: fd [OPTIONS] [pattern] [path]...\n\
|
||||
\n\
|
||||
For more information try '--help'\n\
|
||||
For more information, try '--help'.\n\
|
||||
",
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue