diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/clap_complete | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap_complete')
-rw-r--r-- | vendor/clap_complete/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/clap_complete/Cargo.lock | 473 | ||||
-rw-r--r-- | vendor/clap_complete/Cargo.toml | 45 | ||||
-rw-r--r-- | vendor/clap_complete/README.md | 8 | ||||
-rw-r--r-- | vendor/clap_complete/examples/completion-derive.rs | 22 | ||||
-rw-r--r-- | vendor/clap_complete/examples/completion.rs | 18 | ||||
-rw-r--r-- | vendor/clap_complete/examples/dynamic.rs | 2 | ||||
-rw-r--r-- | vendor/clap_complete/src/dynamic.rs | 44 | ||||
-rw-r--r-- | vendor/clap_complete/src/generator/mod.rs | 31 | ||||
-rw-r--r-- | vendor/clap_complete/src/lib.rs | 2 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/bash.rs | 21 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/elvish.rs | 14 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/fish.rs | 14 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/powershell.rs | 92 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/shell.rs | 2 | ||||
-rw-r--r-- | vendor/clap_complete/src/shells/zsh.rs | 153 |
16 files changed, 512 insertions, 431 deletions
diff --git a/vendor/clap_complete/.cargo-checksum.json b/vendor/clap_complete/.cargo-checksum.json index 6926ea04d..95f19a85c 100644 --- a/vendor/clap_complete/.cargo-checksum.json +++ b/vendor/clap_complete/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"d53222e493cada99842c2d6d0b91233175dc27cafbd4ac39d3a4b262b54c64c3","Cargo.toml":"135479adb22e0d6b534b4ac2ff74ef404d423cf95c77f74021c799094a4902a7","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"1b3588e4808c7c82397439978e29dcd8c34925691dcd46ea52188bc7a18016fa","examples/completion-derive.rs":"09b32a23013801c54a8d97bd9f6491622d5dca511d2697bff14f813607aca123","examples/completion.rs":"57e57d7912c526a819e7316826171cf085f3c776c8e8d3e925045a00f538c35c","examples/dynamic.rs":"ea4acc40d3e0f29dc0a361fe2d492781b0c25f563f0e9c88953bf0c7e1dee118","src/dynamic.rs":"d9d6bd3efad431171207be08865e85ef0b03bd816b5f2568ae13fda9a1383712","src/generator/mod.rs":"539825646f53f940028107fdef70533695ffee70cd8ddb9f5cb98a740b3db78f","src/generator/utils.rs":"2486cdfc9edf1678fed953080ce48b3350e7b4a2f29e7e3a681b64d621f40f47","src/lib.rs":"7d14cf0f58409f4b92efa1e9813b74ad218e233ae07ca60c5f22b728e6635afd","src/macros.rs":"8445231263f03893ab3806e3f50747113bf8d638bd81e2a6bf33c9a0df224421","src/shells/bash.rs":"43db9bf78b1de14507b3dee31361b141a3feddfe156402e52a4d9700cee6bacc","src/shells/elvish.rs":"56504ca90a06d29a5f4efe42319c4465ab5582eb3b4aadec93b4627c165e5b7c","src/shells/fish.rs":"651d635bae3deab880168c2add526a2751f56c1d149aaf47b5a00ea23458a207","src/shells/mod.rs":"002352299be1ece75540e7b1502120590f4635f69a925b19484d272bd5491505","src/shells/powershell.rs":"c53820d916b02774395cb7068833f7c8382f15a89b447e151b430383755efdb7","src/shells/shell.rs":"5896fd71c67c386c0ba3edcf63bda4c81cab0d7b69261ac3f6a2e56a528349ec","src/shells/zsh.rs":"61d34ded630ad766051bd4b8383b8137fd894d452d1a6ee498309851131de81f"},"package":"10861370d2ba66b0f5989f83ebf35db6421713fd92351790e7fdd6c36774c56b"}
\ No newline at end of file +{"files":{"Cargo.lock":"3ef2e9ced2a9bb958b865b5f1f9219f46fea34fbf2e81862dc2f872d09d92575","Cargo.toml":"0cb1fa10f3c7c53dbb719ee68e54d236efb178a1aabf7a89b9e4def712cdf4d4","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"0d687e1f07b58fe68bda74668ff6326125e5e5efa184cce755cd84ac535b7058","README.md":"b59021384cdccc56545ba98e69643b31d1fb012f9878260cc56649346bc49fa0","examples/completion-derive.rs":"9df678ff1b67b7e8e829d53d983960429eb809aac4e72f4c5415a59cee8684a6","examples/completion.rs":"d81c0281ae87280d40381e468c0fa2bb4d8751022fdfd0d11ed9d54598e18d8d","examples/dynamic.rs":"47c023b8d684e39bd95d1837dcbe3980ff29d3c3b19c685f3029c3fa260b882e","src/dynamic.rs":"4577d56abe90307a9e2c3189f3d96d2eaaff6639c07aa411eaa814c396d195f5","src/generator/mod.rs":"5431dc9a27a6995ae330aeaebd0670a8df981ab077dfa4b7e28cafb93dc61bda","src/generator/utils.rs":"2486cdfc9edf1678fed953080ce48b3350e7b4a2f29e7e3a681b64d621f40f47","src/lib.rs":"8ad5e4171dd7ba9dbad24c7e8c90bdf0444a8cc427fe8e5ce2b6407d0dc018ac","src/macros.rs":"8445231263f03893ab3806e3f50747113bf8d638bd81e2a6bf33c9a0df224421","src/shells/bash.rs":"d5d4cef101f0742a8695a7036a4b63151f86225d70898c500ddb0e739b682c4e","src/shells/elvish.rs":"c09e570414213f779b2126eb33784bc39774269ffe4a0654fc32e17d4ac649ae","src/shells/fish.rs":"2266faee22d38f3886792ac14e589cb2a3859593f779789fd4903f3ba6cb10c2","src/shells/mod.rs":"002352299be1ece75540e7b1502120590f4635f69a925b19484d272bd5491505","src/shells/powershell.rs":"d6e4e93afecd6c765fbe2438159a9b11de76c696a5b89d85ec279fb79e43e7d5","src/shells/shell.rs":"4dd9df0bd1f371da370c66808d16ad00a045ba3b997844b1164518b094bba951","src/shells/zsh.rs":"9776f9770172d4464cf412018ee4ee6cc9354fc8ebe14b65061035aeb3cbc38d"},"package":"36774babb166352bb4f7b9cb16f781ffa3439d2a8f12cd31bea85a38c888fea3"}
\ No newline at end of file diff --git a/vendor/clap_complete/Cargo.lock b/vendor/clap_complete/Cargo.lock index dd3bb2d6b..3ddb3d54e 100644 --- a/vendor/clap_complete/Cargo.lock +++ b/vendor/clap_complete/Cargo.lock @@ -18,6 +18,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] +name = "anstream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + +[[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -45,16 +94,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "bytes" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" - -[[package]] name = "cc" -version = "1.0.78" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cfg-if" @@ -64,25 +107,34 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.0.31" +version = "4.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab512b39872b48c5ecf6b3bef2efb56dc0b986630d9da71a21a8c8f6878c334" +checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +dependencies = [ + "anstyle", "backtrace", "bitflags", - "clap_derive", "clap_lex", - "once_cell", ] [[package]] name = "clap_complete" -version = "4.0.7" +version = "4.2.2" dependencies = [ "clap", "clap_lex", "is_executable", - "os_str_bytes", "pathdiff", "shlex", "snapbox", @@ -92,12 +144,11 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", "syn", @@ -105,39 +156,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" [[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concolor" -version = "0.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318d6c16e73b3a900eb212ad6a82fc7d298c5ab8184c7a9998646455bc474a16" -dependencies = [ - "bitflags", - "concolor-query", - "is-terminal", -] - -[[package]] -name = "concolor-query" -version = "0.1.0" +name = "colorchoice" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "crossbeam-channel" @@ -162,9 +189,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" dependencies = [ "autocfg", "cfg-if", @@ -175,9 +202,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", ] @@ -223,9 +250,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "glob" @@ -247,14 +274,20 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -272,9 +305,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", "hashbrown", @@ -287,19 +320,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -312,31 +345,22 @@ dependencies = [ ] [[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] name = "itoa" -version = "1.0.5" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" [[package]] name = "log" @@ -355,9 +379,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.7.1" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -379,19 +403,19 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] [[package]] name = "object" -version = "0.30.0" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] @@ -404,83 +428,55 @@ checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "os_pipe" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" +checksum = "0dceb7e43f59c35ee1548045b2c72945a5a3bb6ce6d6f07cdc13dc8f6bc4930a" dependencies = [ "libc", - "windows-sys", + "winapi", ] [[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - -[[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" -version = "1.6.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ + "autocfg", + "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -496,23 +492,23 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustix" -version = "0.36.5" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scopeguard" @@ -522,18 +518,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.151" +version = "1.0.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" +checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.151" +version = "1.0.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" +checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" dependencies = [ "proc-macro2", "quote", @@ -542,9 +538,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -552,6 +548,15 @@ dependencies = [ ] [[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + +[[package]] name = "shlex" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -559,38 +564,42 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "similar" -version = "2.2.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803" [[package]] name = "snapbox" -version = "0.4.3" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbd7b250c7243273b5aec4ca366fced84ad716d110bb7baae4814678952ebde" +checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" dependencies = [ - "concolor", + "anstream", + "anstyle", + "escargot", "libc", "normalize-line-endings", "os_pipe", "similar", "snapbox-macros", "wait-timeout", - "windows-sys", - "yansi", + "windows-sys 0.45.0", ] [[package]] name = "snapbox-macros" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336" +checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" +dependencies = [ + "anstream", +] [[package]] name = "syn" -version = "1.0.107" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9" dependencies = [ "proc-macro2", "quote", @@ -599,33 +608,32 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808b51e57d0ef8f71115d8f3a01e7d3750d01c79cac4b3eda910f4389fdf92fd" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.15.0" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1541ba70885967e662f69d31ab3aeca7b1aaecfcd58679590b893e9239c3646" +checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" dependencies = [ - "combine", "indexmap", - "itertools", "serde", + "serde_spanned", "toml_datetime", + "winnow", ] [[package]] name = "trycmd" -version = "0.14.5" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381af441e13a3635303d26769620a9454aef05ec3303711efc3f1dd785a33af" +checksum = "2925e71868a12b173c1eb166018c2d2f9dfaedfcaec747bdb6ea2246785d258e" dependencies = [ - "escargot", "glob", "humantime", "humantime-serde", @@ -638,21 +646,21 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] -name = "version_check" -version = "0.9.4" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "wait-timeout" @@ -691,59 +699,152 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.1", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm 0.42.1", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.1", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.1", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm 0.42.1", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] -name = "yansi" -version = "0.5.1" +name = "winnow" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +dependencies = [ + "memchr", +] diff --git a/vendor/clap_complete/Cargo.toml b/vendor/clap_complete/Cargo.toml index 060c43c55..0f853d4c0 100644 --- a/vendor/clap_complete/Cargo.toml +++ b/vendor/clap_complete/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.60.0" +rust-version = "1.64.0" name = "clap_complete" -version = "4.0.7" +version = "4.2.2" include = [ "build.rs", "src/**/*", @@ -40,45 +40,45 @@ targets = ["x86_64-unknown-linux-gnu"] [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -search = "Unreleased" -replace = "{{version}}" min = 1 +replace = "{{version}}" +search = "Unreleased" [[package.metadata.release.pre-release-replacements]] +exactly = 1 file = "CHANGELOG.md" -search = '\.\.\.HEAD' replace = "...{{tag_name}}" -exactly = 1 +search = '\.\.\.HEAD' [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -search = "ReleaseDate" -replace = "{{date}}" min = 1 +replace = "{{date}}" +search = "ReleaseDate" [[package.metadata.release.pre-release-replacements]] +exactly = 1 file = "CHANGELOG.md" -search = "<!-- next-header -->" replace = """ <!-- next-header --> ## [Unreleased] - ReleaseDate """ -exactly = 1 +search = "<!-- next-header -->" [[package.metadata.release.pre-release-replacements]] +exactly = 1 file = "CHANGELOG.md" -search = "<!-- next-url -->" replace = """ <!-- next-url --> [Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD""" -exactly = 1 +search = "<!-- next-url -->" [[package.metadata.release.pre-release-replacements]] -file = "README.md" -search = "github.com/clap-rs/clap/blob/[^/]+/" -replace = "github.com/clap-rs/clap/blob/{{tag_name}}/" exactly = 4 +file = "README.md" prerelease = true +replace = "github.com/clap-rs/clap/blob/{{tag_name}}/" +search = "github.com/clap-rs/clap/blob/[^/]+/" [lib] bench = false @@ -88,24 +88,18 @@ name = "dynamic" required-features = ["unstable-dynamic"] [dependencies.clap] -version = "4.0.0" +version = "4.1.0" features = ["std"] default-features = false [dependencies.clap_lex] -version = "0.3.0" +version = "0.4.0" optional = true [dependencies.is_executable] version = "1.0.1" optional = true -[dependencies.os_str_bytes] -version = "6.0" -features = ["raw_os_str"] -optional = true -default-features = false - [dependencies.pathdiff] version = "0.2.1" optional = true @@ -128,11 +122,11 @@ features = [ default-features = false [dev-dependencies.snapbox] -version = "0.4" +version = "0.4.10" features = ["diff"] [dev-dependencies.trycmd] -version = "0.14.5" +version = "0.14.15" features = [ "color-auto", "diff", @@ -147,7 +141,6 @@ unstable-dynamic = [ "dep:clap_lex", "dep:shlex", "dep:unicode-xid", - "dep:os_str_bytes", "clap/derive", "dep:is_executable", "dep:pathdiff", diff --git a/vendor/clap_complete/README.md b/vendor/clap_complete/README.md index 286775230..e2f0ed35b 100644 --- a/vendor/clap_complete/README.md +++ b/vendor/clap_complete/README.md @@ -5,16 +5,16 @@ [![Crates.io](https://img.shields.io/crates/v/clap_complete?style=flat-square)](https://crates.io/crates/clap_complete) [![Crates.io](https://img.shields.io/crates/d/clap_complete?style=flat-square)](https://crates.io/crates/clap_complete) -[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.0.7/LICENSE-APACHE) -[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.0.7/LICENSE-MIT) +[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.2.2/LICENSE-APACHE) +[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/clap-rs/clap/blob/clap_complete-v4.2.2/LICENSE-MIT) Dual-licensed under [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT). 1. [About](#about) 2. [API Reference](https://docs.rs/clap_complete) 3. [Questions & Discussions](https://github.com/clap-rs/clap/discussions) -4. [CONTRIBUTING](https://github.com/clap-rs/clap/blob/clap_complete-v4.0.7/clap_complete/CONTRIBUTING.md) -5. [Sponsors](https://github.com/clap-rs/clap/blob/clap_complete-v4.0.7/README.md#sponsors) +4. [CONTRIBUTING](https://github.com/clap-rs/clap/blob/clap_complete-v4.2.2/clap_complete/CONTRIBUTING.md) +5. [Sponsors](https://github.com/clap-rs/clap/blob/clap_complete-v4.2.2/README.md#sponsors) ## About diff --git a/vendor/clap_complete/examples/completion-derive.rs b/vendor/clap_complete/examples/completion-derive.rs index 8eeebf89d..9f1a55d7d 100644 --- a/vendor/clap_complete/examples/completion-derive.rs +++ b/vendor/clap_complete/examples/completion-derive.rs @@ -1,16 +1,16 @@ //! How to use value hints and generate shell completions. //! //! Usage with zsh: -//! ```sh -//! cargo run --example value_hints_derive -- --generate=zsh > /usr/local/share/zsh/site-functions/_value_hints_derive -//! compinit -//! ./target/debug/examples/value_hints_derive --<TAB> +//! ```console +//! $ cargo run --example completion-derive -- --generate=zsh > /usr/local/share/zsh/site-functions/_completion_derive +//! $ compinit +//! $ ./target/debug/examples/completion_derive --<TAB> //! ``` //! fish: -//! ```sh -//! cargo run --example value_hints_derive -- --generate=fish > value_hints_derive.fish -//! . ./value_hints_derive.fish -//! ./target/debug/examples/value_hints_derive --<TAB> +//! ```console +//! $ cargo run --example completion-derive -- --generate=fish > completion_derive.fish +//! $ . ./completion_derive.fish +//! $ ./target/debug/examples/completion_derive --<TAB> //! ``` use clap::{Args, Command, CommandFactory, Parser, Subcommand, ValueHint}; use clap_complete::{generate, Generator, Shell}; @@ -24,7 +24,7 @@ struct Opt { // If provided, outputs the completion file for given shell #[arg(long = "generate", value_enum)] generator: Option<Shell>, - #[clap(subcommand)] + #[command(subcommand)] command: Option<Commands>, } @@ -75,9 +75,9 @@ fn main() { if let Some(generator) = opt.generator { let mut cmd = Opt::command(); - eprintln!("Generating completion file for {:?}...", generator); + eprintln!("Generating completion file for {generator:?}..."); print_completions(generator, &mut cmd); } else { - println!("{:#?}", opt); + println!("{opt:#?}"); } } diff --git a/vendor/clap_complete/examples/completion.rs b/vendor/clap_complete/examples/completion.rs index 0455d4f9c..089054259 100644 --- a/vendor/clap_complete/examples/completion.rs +++ b/vendor/clap_complete/examples/completion.rs @@ -1,16 +1,16 @@ //! Example to test arguments with different ValueHint values. //! //! Usage with zsh: -//! ```sh -//! cargo run --example value_hints -- --generate=zsh > /usr/local/share/zsh/site-functions/_value_hints -//! compinit -//! ./target/debug/examples/value_hints --<TAB> +//! ```console +//! $ cargo run --example completion -- --generate=zsh > /usr/local/share/zsh/site-functions/_completion$ +//! $ compinit +//! $ ./target/debug/examples/completion --<TAB> //! ``` //! fish: -//! ```sh -//! cargo run --example value_hints -- --generate=fish > value_hints.fish -//! . ./value_hints.fish -//! ./target/debug/examples/value_hints --<TAB> +//! ```console +//! $ cargo run --example completion -- --generate=fish > completion.fish +//! $ . ./completion.fish +//! $ ./target/debug/examples/completion --<TAB> //! ``` use clap::{value_parser, Arg, Command, ValueHint}; use clap_complete::{generate, Generator, Shell}; @@ -103,7 +103,7 @@ fn main() { if let Some(generator) = matches.get_one::<Shell>("generator") { let mut cmd = build_cli(); - eprintln!("Generating completion file for {}...", generator); + eprintln!("Generating completion file for {generator}..."); print_completions(*generator, &mut cmd); } } diff --git a/vendor/clap_complete/examples/dynamic.rs b/vendor/clap_complete/examples/dynamic.rs index 5abf2de1f..5f1f30acd 100644 --- a/vendor/clap_complete/examples/dynamic.rs +++ b/vendor/clap_complete/examples/dynamic.rs @@ -27,7 +27,7 @@ fn main() { { completions.complete(&mut command()); } else { - println!("{:#?}", matches); + println!("{matches:#?}"); } } diff --git a/vendor/clap_complete/src/dynamic.rs b/vendor/clap_complete/src/dynamic.rs index 929841ec8..f25b4a48d 100644 --- a/vendor/clap_complete/src/dynamic.rs +++ b/vendor/clap_complete/src/dynamic.rs @@ -2,9 +2,11 @@ /// Complete commands within bash pub mod bash { + use std::ffi::OsStr; use std::ffi::OsString; use std::io::Write; + use clap_lex::OsStrExt as _; use unicode_xid::UnicodeXID; #[derive(clap::Subcommand)] @@ -69,7 +71,7 @@ pub mod bash { /// Process the completion request pub fn try_complete(&self, cmd: &mut clap::Command) -> clap::error::Result<()> { - debug!("CompleteCommand::try_complete: {:?}", self); + debug!("CompleteCommand::try_complete: {self:?}"); let CompleteCommand::Complete(args) = self; if let Some(out_path) = args.register.as_deref() { let mut buf = Vec::new(); @@ -122,7 +124,7 @@ pub mod bash { /// The recommended file name for the registration code pub fn file_name(name: &str) -> String { - format!("{}.bash", name) + format!("{name}.bash") } /// Define the completion behavior @@ -152,8 +154,7 @@ pub mod bash { let escaped_name = name.replace('-', "_"); debug_assert!( escaped_name.chars().all(|c| c.is_xid_continue()), - "`name` must be an identifier, got `{}`", - escaped_name + "`name` must be an identifier, got `{escaped_name}`" ); let mut upper_name = escaped_name.clone(); upper_name.make_ascii_uppercase(); @@ -199,7 +200,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES .replace("COMPLETER", &completer) .replace("UPPER", &upper_name); - writeln!(buf, "{}", script)?; + writeln!(buf, "{script}")?; Ok(()) } @@ -320,11 +321,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES return complete_arg(&arg, current_cmd, current_dir, pos_index, is_escaped); } - debug!( - "complete::next: Begin parsing '{:?}' ({:?})", - arg.to_value_os(), - arg.to_value_os().as_raw_bytes() - ); + debug!("complete::next: Begin parsing '{:?}'", arg.to_value_os(),); if let Ok(value) = arg.to_value() { if let Some(next_cmd) = current_cmd.find_subcommand(value) { @@ -388,7 +385,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES crate::generator::utils::longs_and_visible_aliases(cmd) .into_iter() .filter_map(|f| { - f.starts_with(flag).then(|| format!("--{}", f).into()) + f.starts_with(flag).then(|| format!("--{f}").into()) }), ); } @@ -398,7 +395,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES completions.extend( crate::generator::utils::longs_and_visible_aliases(cmd) .into_iter() - .map(|f| format!("--{}", f).into()), + .map(|f| format!("--{f}").into()), ); } @@ -408,7 +405,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES crate::generator::utils::shorts_and_visible_aliases(cmd) .into_iter() // HACK: Need better `OsStr` manipulation - .map(|f| format!("{}{}", arg.to_value_os().to_str_lossy(), f).into()), + .map(|f| format!("{}{}", arg.to_value_os().to_string_lossy(), f).into()), ); } } @@ -428,12 +425,12 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES } fn complete_arg_value( - value: Result<&str, &clap_lex::RawOsStr>, + value: Result<&str, &OsStr>, arg: &clap::Arg, current_dir: Option<&std::path::Path>, ) -> Vec<OsString> { let mut values = Vec::new(); - debug!("complete_arg_value: arg={:?}, value={:?}", arg, value); + debug!("complete_arg_value: arg={arg:?}, value={value:?}"); if let Some(possible_values) = crate::generator::utils::possible_values(arg) { if let Ok(value) = value { @@ -444,7 +441,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES } } else { let value_os = match value { - Ok(value) => clap_lex::RawOsStr::from_str(value), + Ok(value) => OsStr::new(value), Err(value_os) => value_os, }; match arg.get_value_hint() { @@ -485,7 +482,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES } fn complete_path( - value_os: &clap_lex::RawOsStr, + value_os: &OsStr, current_dir: Option<&std::path::Path>, is_wanted: impl Fn(&std::path::Path) -> bool, ) -> Vec<OsString> { @@ -499,10 +496,11 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES } }; let (existing, prefix) = value_os - .split_once('\\') - .unwrap_or((clap_lex::RawOsStr::from_str(""), value_os)); - let root = current_dir.join(existing.to_os_str()); - debug!("complete_path: root={:?}, prefix={:?}", root, prefix); + .split_once("\\") + .unwrap_or((OsStr::new(""), value_os)); + let root = current_dir.join(existing); + debug!("complete_path: root={root:?}, prefix={prefix:?}"); + let prefix = prefix.to_string_lossy(); for entry in std::fs::read_dir(&root) .ok() @@ -510,8 +508,8 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES .flatten() .filter_map(Result::ok) { - let raw_file_name = clap_lex::RawOsString::new(entry.file_name()); - if !raw_file_name.starts_with_os(prefix) { + let raw_file_name = OsString::from(entry.file_name()); + if !raw_file_name.starts_with(&prefix) { continue; } diff --git a/vendor/clap_complete/src/generator/mod.rs b/vendor/clap_complete/src/generator/mod.rs index c025697ed..c6e5c5ec8 100644 --- a/vendor/clap_complete/src/generator/mod.rs +++ b/vendor/clap_complete/src/generator/mod.rs @@ -28,10 +28,10 @@ pub trait Generator { /// pub struct Fish; /// /// impl Generator for Fish { - /// # fn generate(&self, cmd: &Command, buf: &mut dyn Write) {} /// fn file_name(&self, name: &str) -> String { - /// format!("{}.fish", name) + /// format!("{name}.fish") /// } + /// # fn generate(&self, cmd: &Command, buf: &mut dyn Write) {} /// } /// ``` fn file_name(&self, name: &str) -> String; @@ -55,12 +55,12 @@ pub trait Generator { /// pub struct ClapDebug; /// /// impl Generator for ClapDebug { - /// fn generate(&self, cmd: &Command, buf: &mut dyn Write) { - /// write!(buf, "{}", cmd).unwrap(); - /// } /// # fn file_name(&self, name: &str) -> String { - /// # name.into() + /// # name.into() /// # } + /// fn generate(&self, cmd: &Command, buf: &mut dyn Write) { + /// write!(buf, "{cmd}").unwrap(); + /// } /// } /// ``` fn generate(&self, cmd: &Command, buf: &mut dyn Write); @@ -150,7 +150,7 @@ pub trait Generator { /// outdir, // We need to specify where to write to /// )?; /// -/// println!("cargo:warning=completion file is generated: {:?}", path); +/// println!("cargo:warning=completion file is generated: {path:?}"); /// /// Ok(()) /// } @@ -164,7 +164,7 @@ pub trait Generator { /// to see the name of the files generated. pub fn generate_to<G, S, T>( gen: G, - cmd: &mut clap::Command, + cmd: &mut Command, bin_name: S, out_dir: T, ) -> Result<PathBuf, Error> @@ -181,7 +181,7 @@ where let path = out_dir.join(file_name); let mut file = File::create(&path)?; - _generate::<G, S>(gen, cmd, &mut file); + _generate::<G>(gen, cmd, &mut file); Ok(path) } @@ -217,24 +217,19 @@ where /// /// Usage: /// -/// ```shell +/// ```console /// $ myapp generate-bash-completions > /usr/share/bash-completion/completions/myapp.bash /// ``` -pub fn generate<G, S>(gen: G, cmd: &mut clap::Command, bin_name: S, buf: &mut dyn Write) +pub fn generate<G, S>(gen: G, cmd: &mut Command, bin_name: S, buf: &mut dyn Write) where G: Generator, S: Into<String>, { cmd.set_bin_name(bin_name); - _generate::<G, S>(gen, cmd, buf) + _generate::<G>(gen, cmd, buf) } -fn _generate<G, S>(gen: G, cmd: &mut clap::Command, buf: &mut dyn Write) -where - G: Generator, - S: Into<String>, -{ +fn _generate<G: Generator>(gen: G, cmd: &mut Command, buf: &mut dyn Write) { cmd.build(); - gen.generate(cmd, buf) } diff --git a/vendor/clap_complete/src/lib.rs b/vendor/clap_complete/src/lib.rs index 80fead4a5..a44288220 100644 --- a/vendor/clap_complete/src/lib.rs +++ b/vendor/clap_complete/src/lib.rs @@ -49,7 +49,7 @@ //! //! if let Some(generator) = matches.get_one::<Shell>("generator").copied() { //! let mut cmd = build_cli(); -//! eprintln!("Generating completion file for {}...", generator); +//! eprintln!("Generating completion file for {generator}..."); //! print_completions(generator, &mut cmd); //! } //! } diff --git a/vendor/clap_complete/src/shells/bash.rs b/vendor/clap_complete/src/shells/bash.rs index e110537e5..60e6b346c 100644 --- a/vendor/clap_complete/src/shells/bash.rs +++ b/vendor/clap_complete/src/shells/bash.rs @@ -10,7 +10,7 @@ pub struct Bash; impl Generator for Bash { fn file_name(&self, name: &str) -> String { - format!("{}.bash", name) + format!("{name}.bash") } fn generate(&self, cmd: &Command, buf: &mut dyn Write) { @@ -22,7 +22,7 @@ impl Generator for Bash { buf, format!( "_{name}() {{ - local i cur prev opts cmds + local i cur prev opts cmd COMPREPLY=() cur=\"${{COMP_WORDS[COMP_CWORD]}}\" prev=\"${{COMP_WORDS[COMP_CWORD-1]}}\" @@ -114,9 +114,6 @@ fn all_subcommands(cmd: &Command) -> String { "{parent_fn_name},{name}) cmd=\"{fn_name}\" ;;", - parent_fn_name = parent_fn_name, - name = name, - fn_name = fn_name, )); } @@ -161,7 +158,7 @@ fn subcommand_details(cmd: &Command) -> String { } fn option_details_for_path(cmd: &Command, path: &str) -> String { - debug!("option_details_for_path: path={}", path); + debug!("option_details_for_path: path={path}"); let p = utils::find_subcommand_with_path(cmd, path.split("__").skip(1).collect()); let mut opts = vec![String::new()]; @@ -209,22 +206,24 @@ fn vals_for(o: &Arg) -> String { .collect::<Vec<_>>() .join(" ") ) + } else if o.get_value_hint() == ValueHint::Other { + String::from("\"${cur}\"") } else { String::from("$(compgen -f \"${cur}\")") } } fn all_options_for_path(cmd: &Command, path: &str) -> String { - debug!("all_options_for_path: path={}", path); + debug!("all_options_for_path: path={path}"); let p = utils::find_subcommand_with_path(cmd, path.split("__").skip(1).collect()); let mut opts = String::new(); for short in utils::shorts_and_visible_aliases(p) { - write!(&mut opts, "-{} ", short).unwrap(); + write!(&mut opts, "-{short} ").unwrap(); } for long in utils::longs_and_visible_aliases(p) { - write!(&mut opts, "--{} ", long).unwrap(); + write!(&mut opts, "--{long} ").unwrap(); } for pos in p.get_positionals() { if let Some(vals) = utils::possible_values(pos) { @@ -232,11 +231,11 @@ fn all_options_for_path(cmd: &Command, path: &str) -> String { write!(&mut opts, "{} ", value.get_name()).unwrap(); } } else { - write!(&mut opts, "{} ", pos).unwrap(); + write!(&mut opts, "{pos} ").unwrap(); } } for (sc, _) in utils::subcommands(p) { - write!(&mut opts, "{} ", sc).unwrap(); + write!(&mut opts, "{sc} ").unwrap(); } opts.pop(); diff --git a/vendor/clap_complete/src/shells/elvish.rs b/vendor/clap_complete/src/shells/elvish.rs index 07da28348..48a0f852b 100644 --- a/vendor/clap_complete/src/shells/elvish.rs +++ b/vendor/clap_complete/src/shells/elvish.rs @@ -12,7 +12,7 @@ pub struct Elvish; impl Generator for Elvish { fn file_name(&self, name: &str) -> String { - format!("{}.elv", name) + format!("{name}.elv") } fn generate(&self, cmd: &Command, buf: &mut dyn Write) { @@ -46,8 +46,6 @@ set edit:completion:arg-completer[{bin_name}] = {{|@words| $completions[$command] }} "#, - bin_name = bin_name, - subcommands_cases = subcommands_cases ); w!(buf, result.as_bytes()); @@ -83,7 +81,7 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let tooltip = get_tooltip(option.get_help(), shorts[0]); for short in shorts { completions.push_str(&preamble); - completions.push_str(format!("-{} '{}'", short, tooltip).as_str()); + completions.push_str(format!("-{short} '{tooltip}'").as_str()); } } @@ -91,7 +89,7 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let tooltip = get_tooltip(option.get_help(), longs[0]); for long in longs { completions.push_str(&preamble); - completions.push_str(format!("--{} '{}'", long, tooltip).as_str()); + completions.push_str(format!("--{long} '{tooltip}'").as_str()); } } } @@ -101,7 +99,7 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let tooltip = get_tooltip(flag.get_help(), shorts[0]); for short in shorts { completions.push_str(&preamble); - completions.push_str(format!("-{} '{}'", short, tooltip).as_str()); + completions.push_str(format!("-{short} '{tooltip}'").as_str()); } } @@ -109,7 +107,7 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let tooltip = get_tooltip(flag.get_help(), longs[0]); for long in longs { completions.push_str(&preamble); - completions.push_str(format!("--{} '{}'", long, tooltip).as_str()); + completions.push_str(format!("--{long} '{tooltip}'").as_str()); } } } @@ -119,7 +117,7 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let tooltip = get_tooltip(subcommand.get_about(), data); completions.push_str(&preamble); - completions.push_str(format!("{} '{}'", data, tooltip).as_str()); + completions.push_str(format!("{data} '{tooltip}'").as_str()); } let mut subcommands_cases = format!( diff --git a/vendor/clap_complete/src/shells/fish.rs b/vendor/clap_complete/src/shells/fish.rs index fd2f3a4f8..5a069d35b 100644 --- a/vendor/clap_complete/src/shells/fish.rs +++ b/vendor/clap_complete/src/shells/fish.rs @@ -12,7 +12,7 @@ pub struct Fish; impl Generator for Fish { fn file_name(&self, name: &str) -> String { - format!("{}.fish", name) + format!("{name}.fish") } fn generate(&self, cmd: &Command, buf: &mut dyn Write) { @@ -56,7 +56,7 @@ fn gen_fish_inner( // -n "__fish_use_subcommand" # complete for command "myprog" // -n "__fish_seen_subcommand_from subcmd1" # complete for command "myprog subcmd1" - let mut basic_template = format!("complete -c {}", root_command); + let mut basic_template = format!("complete -c {root_command}"); if parent_commands.is_empty() { if cmd.has_subcommands() { @@ -68,10 +68,10 @@ fn gen_fish_inner( " -n \"{}\"", parent_commands .iter() - .map(|command| format!("__fish_seen_subcommand_from {}", command)) + .map(|command| format!("__fish_seen_subcommand_from {command}")) .chain( cmd.get_subcommands() - .map(|command| format!("not __fish_seen_subcommand_from {}", command)) + .map(|command| format!("not __fish_seen_subcommand_from {command}")) ) .collect::<Vec<_>>() .join("; and ") @@ -80,14 +80,14 @@ fn gen_fish_inner( ); } - debug!("gen_fish_inner: parent_commands={:?}", parent_commands); + debug!("gen_fish_inner: parent_commands={parent_commands:?}"); for option in cmd.get_opts() { let mut template = basic_template.clone(); if let Some(shorts) = option.get_short_and_visible_aliases() { for short in shorts { - template.push_str(format!(" -s {}", short).as_str()); + template.push_str(format!(" -s {short}").as_str()); } } @@ -113,7 +113,7 @@ fn gen_fish_inner( if let Some(shorts) = flag.get_short_and_visible_aliases() { for short in shorts { - template.push_str(format!(" -s {}", short).as_str()); + template.push_str(format!(" -s {short}").as_str()); } } diff --git a/vendor/clap_complete/src/shells/powershell.rs b/vendor/clap_complete/src/shells/powershell.rs index 0d3a2a55f..417facf70 100644 --- a/vendor/clap_complete/src/shells/powershell.rs +++ b/vendor/clap_complete/src/shells/powershell.rs @@ -12,7 +12,7 @@ pub struct PowerShell; impl Generator for PowerShell { fn file_name(&self, name: &str) -> String { - format!("_{}.ps1", name) + format!("_{name}.ps1") } fn generate(&self, cmd: &Command, buf: &mut dyn Write) { @@ -50,9 +50,7 @@ Register-ArgumentCompleter -Native -CommandName '{bin_name}' -ScriptBlock {{ $completions.Where{{ $_.CompletionText -like "$wordToComplete*" }} | Sort-Object -Property ListItemText }} -"#, - bin_name = bin_name, - subcommands_cases = subcommands_cases +"# ); w!(buf, result.as_bytes()); @@ -84,63 +82,11 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { let preamble = String::from("\n [CompletionResult]::new("); for option in p.get_opts() { - if let Some(shorts) = option.get_short_and_visible_aliases() { - let tooltip = get_tooltip(option.get_help(), shorts[0]); - for short in shorts { - completions.push_str(&preamble); - completions.push_str( - format!( - "'-{}', '{}', {}, '{}')", - short, short, "[CompletionResultType]::ParameterName", tooltip - ) - .as_str(), - ); - } - } - - if let Some(longs) = option.get_long_and_visible_aliases() { - let tooltip = get_tooltip(option.get_help(), longs[0]); - for long in longs { - completions.push_str(&preamble); - completions.push_str( - format!( - "'--{}', '{}', {}, '{}')", - long, long, "[CompletionResultType]::ParameterName", tooltip - ) - .as_str(), - ); - } - } + generate_aliases(&mut completions, &preamble, option); } for flag in utils::flags(p) { - if let Some(shorts) = flag.get_short_and_visible_aliases() { - let tooltip = get_tooltip(flag.get_help(), shorts[0]); - for short in shorts { - completions.push_str(&preamble); - completions.push_str( - format!( - "'-{}', '{}', {}, '{}')", - short, short, "[CompletionResultType]::ParameterName", tooltip - ) - .as_str(), - ); - } - } - - if let Some(longs) = flag.get_long_and_visible_aliases() { - let tooltip = get_tooltip(flag.get_help(), longs[0]); - for long in longs { - completions.push_str(&preamble); - completions.push_str( - format!( - "'--{}', '{}', {}, '{}')", - long, long, "[CompletionResultType]::ParameterName", tooltip - ) - .as_str(), - ); - } - } + generate_aliases(&mut completions, &preamble, &flag); } for subcommand in p.get_subcommands() { @@ -149,11 +95,8 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { completions.push_str(&preamble); completions.push_str( - format!( - "'{}', '{}', {}, '{}')", - data, data, "[CompletionResultType]::ParameterValue", tooltip - ) - .as_str(), + format!("'{data}', '{data}', [CompletionResultType]::ParameterValue, '{tooltip}')") + .as_str(), ); } @@ -172,3 +115,26 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { subcommands_cases } + +fn generate_aliases(completions: &mut String, preamble: &String, arg: &Arg) { + use std::fmt::Write as _; + + if let Some(aliases) = arg.get_short_and_visible_aliases() { + let tooltip = get_tooltip(arg.get_help(), aliases[0]); + for alias in aliases { + let _ = write!( + completions, + "{preamble}'-{alias}', '{alias}', [CompletionResultType]::ParameterName, '{tooltip}')" + ); + } + } + if let Some(aliases) = arg.get_long_and_visible_aliases() { + let tooltip = get_tooltip(arg.get_help(), aliases[0]); + for alias in aliases { + let _ = write!( + completions, + "{preamble}'--{alias}', '{alias}', [CompletionResultType]::ParameterName, '{tooltip}')" + ); + } + } +} diff --git a/vendor/clap_complete/src/shells/shell.rs b/vendor/clap_complete/src/shells/shell.rs index f6e70f575..52cb2e9b7 100644 --- a/vendor/clap_complete/src/shells/shell.rs +++ b/vendor/clap_complete/src/shells/shell.rs @@ -42,7 +42,7 @@ impl FromStr for Shell { return Ok(*variant); } } - Err(format!("Invalid variant: {}", s)) + Err(format!("invalid variant: {s}")) } } diff --git a/vendor/clap_complete/src/shells/zsh.rs b/vendor/clap_complete/src/shells/zsh.rs index 580de77a2..71c586d8e 100644 --- a/vendor/clap_complete/src/shells/zsh.rs +++ b/vendor/clap_complete/src/shells/zsh.rs @@ -11,7 +11,7 @@ pub struct Zsh; impl Generator for Zsh { fn file_name(&self, name: &str) -> String { - format!("_{}", name) + format!("_{name}") } fn generate(&self, cmd: &Command, buf: &mut dyn Write) { @@ -43,7 +43,11 @@ _{name}() {{ {subcommand_details} -_{name} \"$@\" +if [ \"$funcstack[1]\" = \"_{name}\" ]; then + _{name} \"$@\" +else + compdef _{name} {name} +fi ", name = bin_name, initial_args = get_args_of(cmd, None), @@ -111,8 +115,8 @@ _{bin_name_underscore}_commands() {{ all_subcommands.sort(); all_subcommands.dedup(); - for &(_, ref bin_name) in &all_subcommands { - debug!("subcommand_details:iter: bin_name={}", bin_name); + for (_, ref bin_name) in &all_subcommands { + debug!("subcommand_details:iter: bin_name={bin_name}"); ret.push(format!( "\ @@ -223,14 +227,12 @@ fn get_subcommands_of(parent: &Command) -> String { let subcommand_names = utils::subcommands(parent); let mut all_subcommands = vec![]; - for &(ref name, ref bin_name) in &subcommand_names { + for (ref name, ref bin_name) in &subcommand_names { debug!( - "get_subcommands_of:iter: parent={}, name={}, bin_name={}", + "get_subcommands_of:iter: parent={}, name={name}, bin_name={bin_name}", parent.get_name(), - name, - bin_name, ); - let mut segments = vec![format!("({})", name)]; + let mut segments = vec![format!("({name})")]; let subcommand_args = get_args_of( parser_of(parent, bin_name).expect(INTERNAL_ERROR_MSG), Some(parent), @@ -424,6 +426,9 @@ fn escape_help(string: &str) -> String { .replace('\'', "'\\''") .replace('[', "\\[") .replace(']', "\\]") + .replace(':', "\\:") + .replace('$', "\\$") + .replace('`', "\\`") } /// Escape value string inside single quotes and parentheses @@ -431,6 +436,11 @@ fn escape_value(string: &str) -> String { string .replace('\\', "\\\\") .replace('\'', "'\\''") + .replace('[', "\\[") + .replace(']', "\\]") + .replace(':', "\\:") + .replace('$', "\\$") + .replace('`', "\\`") .replace('(', "\\(") .replace(')', "\\)") .replace(' ', "\\ ") @@ -458,21 +468,14 @@ fn write_opts_of(p: &Command, p_global: Option<&Command>) -> String { Some(val) => val[0].to_string(), }; let vc = match value_completion(o) { - Some(val) => format!(":{}:{}", vn, val), - None => format!(":{}: ", vn), + Some(val) => format!(":{vn}:{val}"), + None => format!(":{vn}: "), }; let vc = vc.repeat(o.get_num_args().expect("built").min_values()); if let Some(shorts) = o.get_short_and_visible_aliases() { for short in shorts { - let s = format!( - "'{conflicts}{multiple}-{arg}+[{help}]{value_completion}' \\", - conflicts = conflicts, - multiple = multiple, - arg = short, - value_completion = vc, - help = help - ); + let s = format!("'{conflicts}{multiple}-{short}+[{help}]{vc}' \\"); debug!("write_opts_of:iter: Wrote...{}", &*s); ret.push(s); @@ -480,14 +483,7 @@ fn write_opts_of(p: &Command, p_global: Option<&Command>) -> String { } if let Some(longs) = o.get_long_and_visible_aliases() { for long in longs { - let l = format!( - "'{conflicts}{multiple}--{arg}=[{help}]{value_completion}' \\", - conflicts = conflicts, - multiple = multiple, - arg = long, - value_completion = vc, - help = help - ); + let l = format!("'{conflicts}{multiple}--{long}=[{help}]{vc}' \\"); debug!("write_opts_of:iter: Wrote...{}", &*l); ret.push(l); @@ -502,11 +498,11 @@ fn arg_conflicts(cmd: &Command, arg: &Arg, app_global: Option<&Command>) -> Stri fn push_conflicts(conflicts: &[&Arg], res: &mut Vec<String>) { for conflict in conflicts { if let Some(s) = conflict.get_short() { - res.push(format!("-{}", s)); + res.push(format!("-{s}")); } if let Some(l) = conflict.get_long() { - res.push(format!("--{}", l)); + res.push(format!("--{l}")); } } } @@ -554,13 +550,7 @@ fn write_flags_of(p: &Command, p_global: Option<&Command>) -> String { }; if let Some(short) = f.get_short() { - let s = format!( - "'{conflicts}{multiple}-{arg}[{help}]' \\", - multiple = multiple, - conflicts = conflicts, - arg = short, - help = help - ); + let s = format!("'{conflicts}{multiple}-{short}[{help}]' \\"); debug!("write_flags_of:iter: Wrote...{}", &*s); @@ -568,13 +558,7 @@ fn write_flags_of(p: &Command, p_global: Option<&Command>) -> String { if let Some(short_aliases) = f.get_visible_short_aliases() { for alias in short_aliases { - let s = format!( - "'{conflicts}{multiple}-{arg}[{help}]' \\", - multiple = multiple, - conflicts = conflicts, - arg = alias, - help = help - ); + let s = format!("'{conflicts}{multiple}-{alias}[{help}]' \\",); debug!("write_flags_of:iter: Wrote...{}", &*s); @@ -584,13 +568,7 @@ fn write_flags_of(p: &Command, p_global: Option<&Command>) -> String { } if let Some(long) = f.get_long() { - let l = format!( - "'{conflicts}{multiple}--{arg}[{help}]' \\", - conflicts = conflicts, - multiple = multiple, - arg = long, - help = help - ); + let l = format!("'{conflicts}{multiple}--{long}[{help}]' \\"); debug!("write_flags_of:iter: Wrote...{}", &*l); @@ -598,13 +576,7 @@ fn write_flags_of(p: &Command, p_global: Option<&Command>) -> String { if let Some(aliases) = f.get_visible_aliases() { for alias in aliases { - let l = format!( - "'{conflicts}{multiple}--{arg}[{help}]' \\", - conflicts = conflicts, - multiple = multiple, - arg = alias, - help = help - ); + let l = format!("'{conflicts}{multiple}--{alias}[{help}]' \\"); debug!("write_flags_of:iter: Wrote...{}", &*l); @@ -622,12 +594,47 @@ fn write_positionals_of(p: &Command) -> String { let mut ret = vec![]; + // Completions for commands that end with two Vec arguments require special care. + // - You can have two Vec args separated with a custom value terminator. + // - You can have two Vec args with the second one set to last (raw sets last) + // which will require a '--' separator to be used before the second argument + // on the command-line. + // + // We use the '-S' _arguments option to disable completion after '--'. Thus, the + // completion for the second argument in scenario (B) does not need to be emitted + // because it is implicitly handled by the '-S' option. + // We only need to emit the first catch-all. + // + // Have we already emitted a catch-all multi-valued positional argument + // without a custom value terminator? + let mut catch_all_emitted = false; + for arg in p.get_positionals() { debug!("write_positionals_of:iter: arg={}", arg.get_id()); let num_args = arg.get_num_args().expect("built"); - let cardinality = if num_args.max_values() > 1 { - "*:" + let is_multi_valued = num_args.max_values() > 1; + + if catch_all_emitted && (arg.is_last_set() || is_multi_valued) { + // This is the final argument and it also takes multiple arguments. + // We've already emitted a catch-all positional argument so we don't need + // to emit anything for this argument because it is implicitly handled by + // the use of the '-S' _arguments option. + continue; + } + + let cardinality_value; + let cardinality = if is_multi_valued { + match arg.get_value_terminator() { + Some(terminator) => { + cardinality_value = format!("*{}:", escape_value(terminator)); + cardinality_value.as_str() + } + None => { + catch_all_emitted = true; + "*:" + } + } } else if !arg.is_required_set() { ":" } else { @@ -641,7 +648,8 @@ fn write_positionals_of(p: &Command) -> String { help = arg .get_help() .map(|s| s.to_string()) - .map_or("".to_owned(), |v| " -- ".to_owned() + &v) + .map(|v| " -- ".to_owned() + &v) + .unwrap_or_else(|| "".to_owned()) .replace('[', "\\[") .replace(']', "\\]") .replace('\'', "'\\''") @@ -649,10 +657,33 @@ fn write_positionals_of(p: &Command) -> String { value_completion = value_completion(arg).unwrap_or_default() ); - debug!("write_positionals_of:iter: Wrote...{}", a); + debug!("write_positionals_of:iter: Wrote...{a}"); ret.push(a); } ret.join("\n") } + +#[cfg(test)] +mod tests { + use crate::shells::zsh::{escape_help, escape_value}; + + #[test] + fn test_escape_value() { + let raw_string = "\\ [foo]() `bar https://$PATH"; + assert_eq!( + escape_value(raw_string), + "\\\\\\ \\[foo\\]\\(\\)\\ \\`bar\\ https\\://\\$PATH" + ) + } + + #[test] + fn test_escape_help() { + let raw_string = "\\ [foo]() `bar https://$PATH"; + assert_eq!( + escape_help(raw_string), + "\\\\ \\[foo\\]() \\`bar https\\://\\$PATH" + ) + } +} |