Skip to content
Myr

Merge pull request #1244 from tmccombs/grouped-occurrences

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by GitHub · parents 9955e20, c34bfa3 · Browse files · 8 files+75 added−22 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • update: Update to clap 4.1

Diff stats

8 files+75 added−22 removed

  • tests:+12 added−4 removed
  • other:+63 added−18 removed

8 files+75 added−22 removed

modified:.github/workflows/CICD.yml+1 added-1 removed
1name: CICD23env:4 MIN_SUPPORTED_RUST_VERSION: "1.60.0"4 MIN_SUPPORTED_RUST_VERSION: "1.64.0"5 CICD_INTERMEDIATES_DIR: "_cicd-intermediates"67on:8 workflow_dispatch:
355 unmodified lines
modified:src/exec/mod.rs+6 added-4 removed
37 unmodified lines
38 commands: Vec<CommandTemplate>,39}4041impl CommandSet {42 pub fn new<I, S>(input: I) -> Result<CommandSet>42 pub fn new<I, T, S>(input: I) -> Result<CommandSet>43 where44 I: IntoIterator<Item = Vec<S>>,44 I: IntoIterator<Item = T>,45 T: IntoIterator<Item = S>,46 S: AsRef<str>,47 {48 Ok(CommandSet {49 mode: ExecutionMode::OneByOne,
3 unmodified lines
53 .collect::<Result<_>>()?,54 })55 }5656 pub fn new_batch<I, S>(input: I) -> Result<CommandSet>57 pub fn new_batch<I, T, S>(input: I) -> Result<CommandSet>58 where58 I: IntoIterator<Item = Vec<S>>,59 I: IntoIterator<Item = T>,60 T: IntoIterator<Item = S>,61 S: AsRef<str>,62 {63 Ok(CommandSet {64 mode: ExecutionMode::Batch,
532 unmodified lines
modified:src/cli.rs+2 added-2 removed
758 unmodified lines
759760impl clap::FromArgMatches for Exec {761 fn from_arg_matches(matches: &ArgMatches) -> clap::error::Result<Self> {762 let command = matches763 .grouped_values_of("exec")763 .get_occurrences::<String>("exec")764 .map(CommandSet::new)765 .or_else(|| {766 matches767 .grouped_values_of("exec_batch")767 .get_occurrences::<String>("exec_batch")768 .map(CommandSet::new_batch)769 })770 .transpose()771 .map_err(|e| clap::Error::raw(ErrorKind::InvalidValue, e))?;
90 unmodified lines
modified:tests/tests.rs+12 added-4 removed
1803 unmodified lines
1804 "error: Only one placeholder allowed for batch commands\n\1805 \n\1806 Usage: fd [OPTIONS] [pattern] [path]...\n\1807 \n\1808 For more information try '--help'\n\1808 For more information, try '--help'.\n\1809 ",1810 );18111812 te.assert_failure_with_error(1813 &["foo", "--exec-batch", "echo", "{/}", ";", "-x", "echo"],1814 "error: The argument '--exec-batch <cmd>...' cannot be used with '--exec <cmd>...'",1814 "error: the argument '--exec-batch <cmd>...' cannot be used with '--exec <cmd>...'\n\1815 \n\1816 Usage: fd --exec-batch <cmd>... <pattern> [path]...\n\1817 \n\1818 For more information, try '--help'.\n\1819 ",1820 );18211822 te.assert_failure_with_error(1823 &["foo", "--exec-batch"],1819 "error: The argument '--exec-batch <cmd>...' requires a value but none was supplied",1824 "error: a value is required for '--exec-batch <cmd>...' but none was supplied\n\1825 \n\1826 For more information, try '--help'.\n\1827 ",1828 );18291830 te.assert_failure_with_error(1831 &["foo", "--exec-batch", "echo {}"],1832 "error: First argument of exec-batch is expected to be a fixed executable\n\1833 \n\1834 Usage: fd [OPTIONS] [pattern] [path]...\n\1835 \n\1828 For more information try '--help'\n\1836 For more information, try '--help'.\n\1837 ",1838 );18391840 te.assert_failure_with_error(&["a.foo", "--exec-batch", "bash", "-c", "exit 1"], "");
711 unmodified lines
modified:build.rs+1 added-1 removed
1fn main() {2 let min_version = "1.60";2 let min_version = "1.64";34 match version_check::is_min_version(min_version) {5 Some(true) => {}6 // rustc version too small or can't figure it out
6 unmodified lines
modified:Cargo.lock+50 added-8 removed
99 unmodified lines
100]101102[[package]]103name = "clap"104version = "4.0.22"104version = "4.1.1"105source = "registry+https://github.com/rust-lang/crates.io-index"106checksum = "91b9970d7505127a162fdaa9b96428d28a479ba78c9ec7550a63a5d9863db682"106checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2"107dependencies = [108 "atty",108 "bitflags",109 "clap_derive",110 "clap_lex",111 "is-terminal",112 "once_cell",113 "strsim",114 "termcolor",115 "terminal_size",
9 unmodified lines
125]126127[[package]]128name = "clap_derive"129version = "4.0.21"129version = "4.1.0"130source = "registry+https://github.com/rust-lang/crates.io-index"131checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"131checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"132dependencies = [133 "heck",134 "proc-macro-error",135 "proc-macro2",
337 unmodified lines
473source = "registry+https://github.com/rust-lang/crates.io-index"474checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0"475476[[package]]477name = "io-lifetimes"478version = "1.0.4"479source = "registry+https://github.com/rust-lang/crates.io-index"480checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"481dependencies = [482 "libc",483 "windows-sys 0.42.0",484]485486[[package]]487name = "is-terminal"488version = "0.4.2"489source = "registry+https://github.com/rust-lang/crates.io-index"490checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"491dependencies = [492 "hermit-abi 0.2.6",493 "io-lifetimes 1.0.4",494 "rustix 0.36.6",495 "windows-sys 0.42.0",496]497498[[package]]499name = "jemalloc-sys"500version = "0.5.2+5.3.0-patched"501source = "registry+https://github.com/rust-lang/crates.io-index"502checksum = "134163979b6eed9564c98637b710b40979939ba351f59952708234ea11b5f3f8"
49 unmodified lines
552source = "registry+https://github.com/rust-lang/crates.io-index"553checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"554555[[package]]556name = "linux-raw-sys"557version = "0.1.4"558source = "registry+https://github.com/rust-lang/crates.io-index"559checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"560561[[package]]562name = "log"563version = "0.4.17"564source = "registry+https://github.com/rust-lang/crates.io-index"565checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
212 unmodified lines
778checksum = "985947f9b6423159c4726323f373be0a21bdb514c5af06a849cb3d2dce2d01e8"779dependencies = [780 "bitflags",781 "errno",754 "io-lifetimes",782 "io-lifetimes 0.7.4",783 "libc",756 "linux-raw-sys",784 "linux-raw-sys 0.0.46",785 "windows-sys 0.36.1",786]787788[[package]]789name = "rustix"790version = "0.36.6"791source = "registry+https://github.com/rust-lang/crates.io-index"792checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"793dependencies = [794 "bitflags",795 "errno",796 "io-lifetimes 1.0.4",797 "libc",798 "linux-raw-sys 0.1.4",799 "windows-sys 0.42.0",800]801802[[package]]803name = "same-file"804version = "1.0.6"805source = "registry+https://github.com/rust-lang/crates.io-index"806checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
58 unmodified lines
865version = "0.2.1"866source = "registry+https://github.com/rust-lang/crates.io-index"867checksum = "8440c860cf79def6164e4a0a983bcc2305d82419177a0e0c71930d049e3ac5a1"868dependencies = [827 "rustix",869 "rustix 0.35.12",870 "windows-sys 0.36.1",871]872873[[package]]
279 unmodified lines
modified:Cargo.toml+2 added-1 removed
modified:clippy.toml+1 added-1 removed