Update dependencies (#817)

This commit is contained in:
Denis Isidoro 2023-04-08 19:28:42 -03:00 committed by GitHub
parent 7abdb057e6
commit 8cf9c96e54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 237 additions and 353 deletions

341
Cargo.lock generated
View file

@ -11,6 +11,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "aligned"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80a21b9440a626c7fc8573a9e3d3a06b75c7c97754c2949bc7857b90353ca655"
dependencies = [
"as-slice",
]
[[package]]
name = "anstream"
version = "0.2.6"
@ -53,9 +62,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.58"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
[[package]]
name = "arrayvec"
@ -63,6 +72,15 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "as-slice"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
dependencies = [
"stable_deref_trait",
]
[[package]]
name = "autocfg"
version = "1.0.1"
@ -145,55 +163,11 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
dependencies = [
"cfg-if",
"crossbeam-utils",
"lazy_static",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
dependencies = [
"cfg-if",
"lazy_static",
]
[[package]]
name = "crossterm"
version = "0.24.0"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab9f7409c70a38a56216480fba371ee460207dd8926ccf5b4160591759559170"
checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
dependencies = [
"bitflags",
"crossterm_winapi",
@ -214,6 +188,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "cvt"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1"
dependencies = [
"cfg-if",
]
[[package]]
name = "directories-next"
version = "2.0.0"
@ -272,6 +255,21 @@ dependencies = [
"libc",
]
[[package]]
name = "fs_at"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37047c0d530b3aefc64e4c4d7c6b1e23030c65973661b70e12c826f426f3f675"
dependencies = [
"aligned",
"cfg-if",
"cvt",
"libc",
"nix",
"smart-default",
"windows-sys 0.45.0",
]
[[package]]
name = "getrandom"
version = "0.2.3"
@ -285,9 +283,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.9.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
@ -295,15 +293,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.1"
@ -312,9 +301,9 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "indexmap"
version = "1.6.2"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown",
@ -326,7 +315,7 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb"
dependencies = [
"hermit-abi 0.3.1",
"hermit-abi",
"libc",
"windows-sys 0.45.0",
]
@ -337,12 +326,18 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8"
dependencies = [
"hermit-abi 0.3.1",
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys 0.45.0",
]
[[package]]
name = "itoa"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -355,12 +350,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "linked-hash-map"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "linux-raw-sys"
version = "0.3.1"
@ -391,15 +380,6 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "memoffset"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
[[package]]
name = "mio"
version = "0.8.3"
@ -423,7 +403,7 @@ dependencies = [
"edit",
"lazy_static",
"regex",
"remove_dir_all 0.7.0",
"remove_dir_all 0.8.2",
"serde",
"serde_yaml",
"shellwords",
@ -433,13 +413,24 @@ dependencies = [
]
[[package]]
name = "num_cpus"
version = "1.13.0"
name = "nix"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [
"hermit-abi 0.1.18",
"bitflags",
"cfg-if",
"libc",
"static_assertions",
]
[[package]]
name = "normpath"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
@ -535,31 +526,6 @@ dependencies = [
"rand_core",
]
[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
dependencies = [
"autocfg",
"crossbeam-deque",
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"lazy_static",
"num_cpus",
]
[[package]]
name = "redox_syscall"
version = "0.2.8"
@ -581,9 +547,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.6.0"
version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
dependencies = [
"aho-corasick",
"memchr",
@ -592,9 +558,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.27"
version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]]
name = "remove_dir_all"
@ -607,15 +573,18 @@ dependencies = [
[[package]]
name = "remove_dir_all"
version = "0.7.0"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "882f368737489ea543bc5c340e6f3d34a28c39980bd9a979e47322b26f60ac40"
checksum = "23895cfadc1917fed9c6ed76a8c2903615fa3704f7493ff82b364c6540acc02b"
dependencies = [
"aligned",
"cfg-if",
"cvt",
"fs_at",
"lazy_static",
"libc",
"log",
"num_cpus",
"rayon",
"winapi",
"normpath",
"windows-sys 0.45.0",
]
[[package]]
@ -655,34 +624,35 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.140"
version = "1.0.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.140"
version = "1.0.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.94",
"syn 2.0.13",
]
[[package]]
name = "serde_yaml"
version = "0.8.26"
version = "0.9.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"yaml-rust",
"unsafe-libyaml",
]
[[package]]
@ -731,6 +701,29 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "smart-default"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.94",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strip-ansi-escapes"
version = "0.1.1"
@ -784,22 +777,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.31"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.31"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.94",
"syn 2.0.13",
]
[[package]]
@ -814,6 +807,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "unsafe-libyaml"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
[[package]]
name = "utf8parse"
version = "0.2.1"
@ -843,12 +842,11 @@ dependencies = [
[[package]]
name = "walkdir"
version = "2.3.2"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
dependencies = [
"same-file",
"winapi",
"winapi-util",
]
@ -937,7 +935,16 @@ version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
"windows-targets 0.42.2",
]
[[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]]
@ -946,21 +953,42 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[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.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[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.32.0"
@ -979,6 +1007,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[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.32.0"
@ -997,6 +1031,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.32.0"
@ -1015,6 +1055,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[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.32.0"
@ -1033,12 +1079,24 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.32.0"
@ -1058,10 +1116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "yaml-rust"
version = "0.4.5"
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

View file

@ -19,20 +19,20 @@ disable-repo-management = []
travis-ci = { repository = "denisidoro/navi", branch = "master" }
[dependencies]
regex = { version = "1.6.0", default-features = false, features = ["std", "unicode-perl"] }
regex = { version = "1.7.3", default-features = false, features = ["std", "unicode-perl"] }
clap = { version = "4.2.1", features = ["derive", "cargo"] }
crossterm = "0.24.0"
crossterm = "0.26.1"
lazy_static = "1.4.0"
directories-next = "2.0.0"
walkdir = "2.3.2"
walkdir = "2.3.3"
shellwords = "1.1.0"
anyhow = "1.0.58"
thiserror = "1.0.31"
anyhow = "1.0.70"
thiserror = "1.0.40"
strip-ansi-escapes = "0.1.1"
edit = "0.1.4"
remove_dir_all = "0.7.0"
serde = { version = "1.0.140", features = ["derive"] }
serde_yaml = "0.8.26"
remove_dir_all = "0.8.2"
serde = { version = "1.0.159", features = ["derive"] }
serde_yaml = "0.9.21"
[lib]
name = "navi"

View file

@ -20,7 +20,7 @@ pub fn call(query: &str) -> Result<Vec<String>> {
let args = ["-qO-", &format!("cheat.sh/{}", query)];
let child = Command::new("wget")
.args(&args)
.args(args)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn();
@ -38,7 +38,7 @@ Make sure wget is correctly installed.";
if let Some(0) = out.status.code() {
let stdout = out.stdout;
let plain_bytes = strip_ansi_escapes::strip(&stdout)?;
let plain_bytes = strip_ansi_escapes::strip(stdout)?;
let markdown = String::from_utf8(plain_bytes).context("Output is invalid utf8")?;
if markdown.starts_with("Unknown topic.") {

View file

@ -55,7 +55,7 @@ pub fn call(query: &str) -> Result<Vec<String>> {
let args = [query, "--markdown"];
let child = Command::new("tldr")
.args(&args)
.args(args)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())

View file

@ -43,7 +43,7 @@ fn prompt_finder(
let child = shell::out()
.stdout(Stdio::piped())
.arg(&suggestion_command)
.arg(suggestion_command)
.spawn()
.map_err(|e| ShellSpawnError::new(suggestion_command, e))?;
@ -207,7 +207,7 @@ pub fn act(
env_var::set(env_var::PREVIEW_INITIAL_SNIPPET, &snippet);
env_var::set(env_var::PREVIEW_TAGS, &tags);
env_var::set(env_var::PREVIEW_COMMENT, &comment);
env_var::set(env_var::PREVIEW_COMMENT, comment);
let interpolated_snippet = {
let mut s = replace_variables_from_snippet(

View file

@ -30,8 +30,8 @@ pub fn last_command() -> Result<()> {
}
for (pattern, escaped) in replacements.clone() {
text = text.replace(&escaped, pattern);
extracted = extracted.replace(&escaped, pattern);
text = text.replace(escaped, pattern);
extracted = extracted.replace(escaped, pattern);
}
println!("{}", extracted.trim_start());

View file

@ -94,7 +94,7 @@ impl Runnable for Input {
value
} else if is_current {
finder::process(value, column, delimiter.as_deref(), map.clone())
.expect("Unable to process value")
.expect("Unable to process value")
} else {
"".to_string()
}

View file

@ -29,7 +29,7 @@ pub fn main() -> Result<String> {
p
};
let repos = fs::read_to_string(&feature_repos_file).context("Unable to fetch featured repositories")?;
let repos = fs::read_to_string(feature_repos_file).context("Unable to fetch featured repositories")?;
let opts = FinderOpts {
column: Some(1),

View file

@ -1,21 +0,0 @@
use super::prelude::*;
pub trait Component: Any + AsAny + Send + Sync {}
pub trait AsAny: Any {
fn as_any(&self) -> &dyn Any;
fn as_mut_any(&mut self) -> &mut dyn Any;
}
impl<T> AsAny for T
where
T: Any,
{
fn as_any(&self) -> &dyn Any {
self
}
fn as_mut_any(&mut self) -> &mut dyn Any {
self
}
}

View file

@ -1,7 +0,0 @@
use super::prelude::*;
pub trait HasDeps {
fn deps(&self) -> HashSet<TypeId> {
HashSet::new()
}
}

View file

@ -1,50 +0,0 @@
use super::prelude::*;
use serde::de::DeserializeOwned;
#[cfg(feature = "yaml")]
pub fn yaml_from_path<T>(path: &Path) -> Result<T>
where
T: DeserializeOwned,
{
let file = File::open(path)?;
let reader = BufReader::new(file);
let config: T = serde_yaml::from_reader(reader)?; // TODO: show path + original error message?
Ok(config)
}
#[cfg(feature = "json")]
pub fn json_from_path<T>(path: &Path) -> Result<T>
where
T: DeserializeOwned,
{
let file = File::open(path)?;
let reader = BufReader::new(file);
let config: T = serde_json::from_reader(reader)?; // TODO: show path + original error message?
Ok(config)
}
#[cfg(feature = "yaml")]
pub fn yaml_from_str<T>(text: &str) -> Result<T>
where
T: DeserializeOwned,
{
serde_yaml::from_str(text)
.with_context(|| format!("Failed to deserialize into yaml:\n{}", text))
}
#[cfg(feature = "json")]
pub fn json_from_str<T>(text: &str) -> Result<T>
where
T: DeserializeOwned,
{
serde_json::from_str(text)
.with_context(|| format!("Failed to deserialize into json:\n{}", text))
}
#[cfg(feature = "yaml")]
pub fn to_yaml_str<T>(t: &T) -> Result<String>
where
T: Serialize,
{
serde_yaml::to_string(t).with_context(|| "Failed to serialize into yaml") // TODO: debug struct?
}

View file

@ -4,7 +4,7 @@ use std::process::Command;
pub fn shallow_clone(uri: &str, target: &str) -> Result<()> {
Command::new("git")
.args(&["clone", uri, target, "--depth", "1"])
.args(["clone", uri, target, "--depth", "1"])
.spawn()
.map_err(|e| ShellSpawnError::new("git clone", e))?
.wait()

View file

@ -38,7 +38,7 @@ pub fn out() -> Command {
let mut words_vec = shellwords::split(&words_str).expect("empty shell command");
let mut words = words_vec.iter_mut();
let first_cmd = words.next().expect("absent shell binary");
let mut cmd = Command::new(&first_cmd);
let mut cmd = Command::new(first_cmd);
cmd.args(words);
let dash_c = if words_str.contains("cmd.exe") { "/c" } else { "-c" };
cmd.arg(dash_c);

View file

@ -1,57 +0,0 @@
use super::prelude::*;
use std::collections::hash_map::Entry;
pub struct System<C> {
pub config: Arc<C>,
components: HashMap<TypeId, Arc<dyn Component>>,
type_ids: Option<HashSet<TypeId>>,
}
impl<C> System<C> {
pub fn new(config: C) -> Result<Self> {
Ok(System {
config: Arc::new(config),
components: HashMap::new(),
type_ids: None,
})
}
pub fn get<T>(&self) -> Result<&T>
where
T: Component,
{
let type_id = TypeId::of::<T>();
let c = self.components.get(&type_id).unwrap();
c.as_any().downcast_ref::<T>().context("invalid component")
}
pub fn set_type_ids(&mut self, type_ids: HashSet<TypeId>) {
self.type_ids = Some(type_ids);
}
pub fn maybe_add<T: Component, F: FnOnce(&Self) -> Result<T>>(
&mut self,
type_id: &TypeId,
f: F,
) -> Result<Option<Arc<T>>> {
let should_init = self
.type_ids
.as_ref()
.context("system has no typeIds")?
.contains(type_id);
if !should_init {
Ok(None)
} else {
let component = f(self)?;
let arc = Arc::new(component);
let entry = self.components.entry(*type_id);
if let Entry::Vacant(e) = entry {
e.insert(arc.clone());
Ok(Some(arc))
} else {
Err(anyhow!("typeId already included in component map"))
}
}
}
}

View file

@ -1,36 +0,0 @@
use std::env;
use super::prelude::*;
static RUST_LOG: &str = "RUST_LOG";
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TracingConfig {
pub time: bool,
pub level: String,
}
pub fn init(config: Option<&TracingConfig>) {
if let Some(tracing) = config {
let level_is_set = match env::var(RUST_LOG) {
Err(_) => false,
Ok(v) => !v.is_empty(),
};
if !level_is_set {
env::set_var(RUST_LOG, &tracing.level);
}
let t = tracing_subscriber::fmt();
let res = if tracing.time {
t.try_init()
} else {
t.without_time().try_init()
};
if let Err(e) = res {
error!("unable to set tracing subscriber: {}", e);
}
}
}

View file

@ -13,7 +13,7 @@ use std::path::MAIN_SEPARATOR;
use walkdir::WalkDir;
pub fn all_cheat_files(path: &Path) -> Vec<String> {
WalkDir::new(&path)
WalkDir::new(path)
.follow_links(true)
.into_iter()
.filter_map(|e| e.ok())
@ -91,7 +91,7 @@ fn interpolate_paths(paths: String) -> String {
let mut newtext = paths.to_string();
for capture in re.captures_iter(&paths) {
if let Some(c) = capture.get(0) {
let varname = c.as_str().replace('$', "").replace('{', "").replace('}', "");
let varname = c.as_str().replace(['$', '{', '}'], "");
if let Ok(replacement) = &env_var::get(&varname) {
newtext = newtext
.replace(&format!("${}", varname), replacement)

View file

@ -56,7 +56,7 @@ impl FinderChoice {
Self::Skim => "sk",
};
let mut command = Command::new(&finder_str);
let mut command = Command::new(finder_str);
let opts = finder_opts.clone();
let preview_height = match self {
@ -70,7 +70,7 @@ impl FinderChoice {
""
};
command.args(&[
command.args([
"--preview",
"",
"--preview-window",
@ -97,48 +97,48 @@ impl FinderChoice {
}
SuggestionType::Disabled => {
if let Self::Fzf = self {
command.args(&["--print-query", "--no-select-1"]);
command.args(["--print-query", "--no-select-1"]);
};
}
SuggestionType::SnippetSelection => {
command.args(&["--expect", "ctrl-y,ctrl-o,enter"]);
command.args(["--expect", "ctrl-y,ctrl-o,enter"]);
}
SuggestionType::SingleRecommendation => {
command.args(&["--print-query", "--expect", "tab,enter"]);
command.args(["--print-query", "--expect", "tab,enter"]);
}
_ => {}
}
if let Some(p) = opts.preview {
command.args(&["--preview", &p]);
command.args(["--preview", &p]);
}
if let Some(q) = opts.query {
command.args(&["--query", &q]);
command.args(["--query", &q]);
}
if let Some(f) = opts.filter {
command.args(&["--filter", &f]);
command.args(["--filter", &f]);
}
if let Some(d) = opts.delimiter {
command.args(&["--delimiter", &d]);
command.args(["--delimiter", &d]);
}
if let Some(h) = opts.header {
command.args(&["--header", &h]);
command.args(["--header", &h]);
}
if let Some(p) = opts.prompt {
command.args(&["--prompt", &p]);
command.args(["--prompt", &p]);
}
if let Some(pw) = opts.preview_window {
command.args(&["--preview-window", &pw]);
command.args(["--preview-window", &pw]);
}
if opts.header_lines > 0 {
command.args(&["--header-lines", format!("{}", opts.header_lines).as_str()]);
command.args(["--header-lines", format!("{}", opts.header_lines).as_str()]);
}
if let Some(o) = opts.overrides {

View file

@ -89,7 +89,7 @@ pub(super) fn parse_output_single(mut text: String, suggestion_type: SuggestionT
SuggestionType::SingleRecommendation => {
let lines: Vec<&str> = text.lines().collect();
match (lines.get(0), lines.get(1), lines.get(2)) {
match (lines.first(), lines.get(1), lines.get(2)) {
(Some(one), Some(termination), Some(two))
if *termination == "enter" || termination.is_empty() =>
{

View file

@ -257,7 +257,7 @@ impl<'a> Parser<'a> {
if !item.tags.is_empty() && !item.comment.is_empty() {}
// blank
if line.is_empty() {
if !(&item.snippet).is_empty() {
if !item.snippet.is_empty() {
item.snippet.push_str(deser::LINE_SEPARATOR);
}
}
@ -316,7 +316,7 @@ impl<'a> Parser<'a> {
}
// snippet
else {
if !(&item.snippet).is_empty() {
if !item.snippet.is_empty() {
item.snippet.push_str(deser::LINE_SEPARATOR);
}
item.snippet.push_str(&line);

View file

@ -4,7 +4,7 @@ use crate::structures::fetcher;
pub fn populate_cheatsheet(parser: &mut Parser) -> Result<()> {
let cheatsheet = include_str!("../docs/navi.cheat");
let lines = cheatsheet.split('\n').into_iter().map(|s| Ok(s.to_string()));
let lines = cheatsheet.split('\n').map(|s| Ok(s.to_string()));
parser.read_lines(lines, "welcome", None)?;

View file

@ -58,7 +58,7 @@ _navi_tldr() {
_navi_cheatsh() {
_navi --cheatsh docker --query remove --print --best-match \
| test::contains "docker rm"
| test::contains "docker container prune"
}
_navi_widget() {