diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6370409..c66e6ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: matrix: os: [ubuntu-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: actions-rs/toolchain@v1 @@ -46,7 +46,7 @@ jobs: authToken: ${{ env.CACHIX_AUTH_TOKEN }} name: zoxide - name: Setup cache - uses: Swatinem/rust-cache@v2.7.7 + uses: Swatinem/rust-cache@v2.8.0 with: key: ${{ matrix.os }} - name: Install just diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3631552..5e05df1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: target: aarch64-pc-windows-msvc steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Get version @@ -59,7 +59,7 @@ jobs: override: true target: ${{ matrix.target }} - name: Setup cache - uses: Swatinem/rust-cache@v2.7.7 + uses: Swatinem/rust-cache@v2.8.0 with: key: ${{ matrix.target }} - name: Install cross @@ -67,7 +67,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: install - args: --color=always --git=https://github.com/cross-rs/cross.git --locked --rev=02bf930e0cb0c6f1beffece0788f3932ecb2c7eb --verbose cross + args: --color=always --git=https://github.com/cross-rs/cross.git --locked --rev=e281947ca900da425e4ecea7483cfde646c8a1ea --verbose cross - name: Build binary uses: actions-rs/cargo@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index d47ae49..071a7c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.9.8] - 2025-05-27 + +### Added + +- Support for Tcsh. +- Added `--score` flag to `zoxide add`. +- POSIX: add doctor to diagnose common issues. +- Nushell: add CLI completions. ### Changed -- Bash: zoxide will now rewrite the prompt when using Space-Tab completions. +- Bash: zoxide will now automatically `cd` when selecting Space-Tab completions. + +### Fixed + +- Bash: doctor now handles `PROMPT_COMMAND` being an array. +- Bash: doctor now handles Visual Studio Code's shell integration. +- Bash: completions now work with `ble.sh`. +- Nushell: stop ignoring symlinks when `cd`-ing into a directory. +- Fzf: updated minimum supported version to v0.51.0. +- PowerShell: avoid setting `$error` when defining `__zoxide_hooked`. +- PowerShell: handle special characters in file paths when `cd`-ing into them. +- Database corruption issue when the filesystem is 100% full. ## [0.9.7] - 2025-02-10 @@ -518,6 +536,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GitHub Actions pipeline to build and upload releases. - Add support for Zsh. +[0.9.8]: https://github.com/ajeetdsouza/zoxide/compare/v0.9.7...v0.9.8 [0.9.7]: https://github.com/ajeetdsouza/zoxide/compare/v0.9.6...v0.9.7 [0.9.6]: https://github.com/ajeetdsouza/zoxide/compare/v0.9.5...v0.9.6 [0.9.5]: https://github.com/ajeetdsouza/zoxide/compare/v0.9.4...v0.9.5 diff --git a/Cargo.lock b/Cargo.lock index 2e9124f..732e696 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,19 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "getrandom", - "once_cell", - "version_check", - "zerocopy", -] +version = 4 [[package]] name = "aho-corasick" @@ -32,9 +19,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -47,49 +34,87 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell_polyfill", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "askama" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" +dependencies = [ + "askama_derive", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama_derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" +dependencies = [ + "askama_parser", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "syn", +] + +[[package]] +name = "askama_parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358" +dependencies = [ + "memchr", + "winnow", +] [[package]] name = "assert_cmd" -version = "2.0.16" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" +checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66" dependencies = [ "anstyle", "bstr", @@ -101,12 +126,6 @@ dependencies = [ "wait-timeout", ] -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - [[package]] name = "bincode" version = "1.3.3" @@ -118,27 +137,21 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bstr" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", "regex-automata", "serde", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "cfg-if" version = "1.0.0" @@ -153,9 +166,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.17" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" dependencies = [ "clap_builder", "clap_derive", @@ -163,9 +176,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" dependencies = [ "anstream", "anstyle", @@ -175,9 +188,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.28" +version = "4.5.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b378c786d3bde9442d2c6dd7e6080b2a818db2b96e30d6e7f1b6d224eb617d3" +checksum = "c91d3baa3bcd889d60e6ef28874126a0b384fd225ab83aa6d8a801c519194ce1" dependencies = [ "clap", ] @@ -193,10 +206,20 @@ dependencies = [ ] [[package]] -name = "clap_derive" -version = "4.5.13" +name = "clap_complete_nushell" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "c6a8b1593457dfc2fe539002b795710d022dc62a65bf15023f039f9760c7b18a" +dependencies = [ + "clap", + "clap_complete", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -206,24 +229,24 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "color-print" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee543c60ff3888934877a5671f45494dd27ed4ba25c6670b9a7576b7ed7a8c0" +checksum = "3aa954171903797d5623e047d9ab69d91b493657917bdfb8c2c80ecaf9cdb6f4" dependencies = [ "color-print-proc-macro", ] [[package]] name = "color-print-proc-macro" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ff1a80c5f3cb1ca7c06ffdd71b6a6dd6d8f896c42141fbd43f50ed28dcdb93" +checksum = "692186b5ebe54007e45a59aea47ece9eb4108e141326c304cdc91699a7118a22" dependencies = [ "nom", "proc-macro2", @@ -233,9 +256,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "difflib" @@ -245,23 +268,23 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "dirs" -version = "5.0.1" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -278,48 +301,60 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "heck" @@ -333,41 +368,23 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libredox" @@ -381,19 +398,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "memchr" @@ -401,22 +408,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -425,9 +416,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nix" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags", "cfg-if", @@ -447,21 +438,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "once_map" -version = "0.4.19" +name = "once_cell_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c7f82d6d446dd295845094f3a76bcdc5e6183b66667334e169f019cd05e5a0" -dependencies = [ - "ahash", - "hashbrown", - "parking_lot", - "stable_deref_trait", -] +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "option-ext" @@ -471,9 +456,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ouroboros" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67" +checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59" dependencies = [ "aliasable", "ouroboros_macro", @@ -482,12 +467,11 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" +checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0" dependencies = [ "heck 0.4.1", - "itertools", "proc-macro2", "proc-macro2-diagnostics", "quote", @@ -495,42 +479,25 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.12.3" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "predicates" -version = "3.1.2" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" +checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" dependencies = [ "anstyle", "difflib", @@ -539,15 +506,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" +checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" [[package]] name = "predicates-tree" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" dependencies = [ "predicates-core", "termtree", @@ -555,9 +522,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -577,13 +544,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "rand" version = "0.8.5" @@ -611,34 +584,25 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" -dependencies = [ - "bitflags", + "getrandom 0.2.16", ] [[package]] name = "redox_users" -version = "0.4.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ - "getrandom", + "getrandom 0.2.16", "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -648,9 +612,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -659,9 +623,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relative-path" @@ -669,58 +633,20 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" -[[package]] -name = "rinja" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a73141aab0b35b30bb993f5c832b8c9211709563b8b95517713b7d00ebb063e" -dependencies = [ - "itoa", - "rinja_derive", -] - -[[package]] -name = "rinja_derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b0baa0b963e94a919d0dcad5be1e2d30dcc0fdab93d9803ab4a019e188647c" -dependencies = [ - "memchr", - "mime", - "mime_guess", - "once_map", - "proc-macro2", - "quote", - "rinja_parser", - "rustc-hash", - "syn", -] - -[[package]] -name = "rinja_parser" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27303ef1ee98bb4240e3dd417f26459061e068d331b7ad05576167da3ae59a4e" -dependencies = [ - "memchr", - "nom", -] - [[package]] name = "rstest" -version = "0.23.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2c585be59b6b5dd66a9d2084aa1d8bd52fbdb806eafdeffb52791147862035" +checksum = "f5a3193c063baaa2a95a33f03035c8a72b83d97a54916055ba22d35ed3839d49" dependencies = [ "rstest_macros", - "rustc_version", ] [[package]] name = "rstest_macros" -version = "0.23.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825ea780781b15345a146be27eaefb05085e337e869bff01b4306a4fd4a9ad5a" +checksum = "9c845311f0ff7951c5506121a9ad75aec44d083c31583b2ea5a30bcb0b0abba0" dependencies = [ "cfg-if", "glob", @@ -746,9 +672,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_version" @@ -761,43 +687,43 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "ryu" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "semver" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -805,16 +731,16 @@ dependencies = [ ] [[package]] -name = "smallvec" -version = "1.13.2" +name = "serde_json" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] [[package]] name = "static_assertions" @@ -830,9 +756,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.87" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -841,57 +767,48 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] name = "termtree" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "thiserror" -version = "1.0.63" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "utf8parse" @@ -907,9 +824,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" dependencies = [ "libc", ] @@ -921,57 +838,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "which" -version = "6.0.3" +name = "wasi" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "which" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", - "home", + "env_home", "rustix", "winsafe", ] -[[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.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -980,46 +873,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -1032,60 +907,54 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + [[package]] name = "winsafe" version = "0.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + [[package]] name = "yansi" version = "1.0.1" @@ -1094,19 +963,18 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", @@ -1115,14 +983,16 @@ dependencies = [ [[package]] name = "zoxide" -version = "0.9.7" +version = "0.9.8" dependencies = [ "anyhow", + "askama", "assert_cmd", "bincode", "clap", "clap_complete", "clap_complete_fig", + "clap_complete_nushell", "color-print", "dirs", "dunce", @@ -1130,7 +1000,6 @@ dependencies = [ "glob", "nix", "ouroboros", - "rinja", "rstest", "rstest_reuse", "serde", diff --git a/Cargo.toml b/Cargo.toml index 7835ccc..58b0d57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,52 +2,56 @@ authors = ["Ajeet D'Souza <98ajeet@gmail.com>"] categories = ["command-line-utilities", "filesystem"] description = "A smarter cd command for your terminal" -edition = "2021" +edition = "2024" homepage = "https://github.com/ajeetdsouza/zoxide" keywords = ["cli", "filesystem", "shell", "tool", "utility"] license = "MIT" name = "zoxide" readme = "README.md" repository = "https://github.com/ajeetdsouza/zoxide" -rust-version = "1.74.1" -version = "0.9.7" +rust-version = "1.85.0" +version = "0.9.8" [badges] maintenance = { status = "actively-developed" } [dependencies] anyhow = "1.0.32" +askama = { version = "0.14.0", default-features = false, features = [ + "derive", + "std", +] } bincode = "1.3.1" clap = { version = "4.3.0", features = ["derive"] } color-print = "0.3.4" -dirs = "5.0.0" +dirs = "6.0.0" dunce = "1.0.1" fastrand = "2.0.0" glob = "0.3.0" ouroboros = "0.18.3" -rinja = { version = "0.3.2", default-features = false } serde = { version = "1.0.116", features = ["derive"] } [target.'cfg(unix)'.dependencies] -nix = { version = "0.29.0", default-features = false, features = [ +nix = { version = "0.30.1", default-features = false, features = [ "fs", "user", ] } [target.'cfg(windows)'.dependencies] -which = "6.0.0" +which = "7.0.3" [build-dependencies] clap = { version = "4.3.0", features = ["derive"] } -clap_complete = "4.3.0" -clap_complete_fig = "4.3.0" +clap_complete = "4.5.50" +clap_complete_fig = "4.5.2" +clap_complete_nushell = "4.5.5" color-print = "0.3.4" [dev-dependencies] assert_cmd = "2.0.0" -rstest = { version = "0.23.0", default-features = false } +rstest = { version = "0.26.0", default-features = false } rstest_reuse = "0.7.0" -tempfile = "3.1.0" +tempfile = "3.15.0" [features] default = [] diff --git a/README.md b/README.md index 3c7f043..87bb2ca 100644 --- a/README.md +++ b/README.md @@ -86,34 +86,35 @@ zoxide can be installed in 4 easy steps: > > Or, you can use a package manager: > - > | Distribution | Repository | Instructions | - > | ------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------- | - > | **_Any_** | **[crates.io]** | `cargo install zoxide --locked` | - > | _Any_ | [asdf] | `asdf plugin add zoxide https://github.com/nyrst/asdf-zoxide.git`
`asdf install zoxide latest` | - > | _Any_ | [conda-forge] | `conda install -c conda-forge zoxide` | - > | _Any_ | [guix] | `guix install zoxide` | - > | _Any_ | [Linuxbrew] | `brew install zoxide` | - > | _Any_ | [nixpkgs] | `nix-env -iA nixpkgs.zoxide` | - > | AlmaLinux | | `dnf install zoxide` | - > | Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` | - > | Arch Linux | [Arch Linux Extra] | `pacman -S zoxide` | - > | CentOS Stream | | `dnf install zoxide` | - > | ~Debian 11+~[^1] | ~[Debian Packages]~ | ~`apt install zoxide`~ | - > | Devuan 4.0+ | [Devuan Packages] | `apt install zoxide` | - > | Exherbo Linux | [Exherbo packages] | `cave resolve -x repository/rust`
`cave resolve -x zoxide` | - > | Fedora 32+ | [Fedora Packages] | `dnf install zoxide` | - > | Gentoo | [Gentoo Packages] | `emerge app-shells/zoxide` | - > | Manjaro | | `pacman -S zoxide` | - > | openSUSE Tumbleweed | [openSUSE Factory] | `zypper install zoxide` | - > | ~Parrot OS~[^1] | | ~`apt install zoxide`~ | - > | ~Raspbian 11+~[^1] | ~[Raspbian Packages]~ | ~`apt install zoxide`~ | - > | RHEL 8+ | | `dnf install zoxide` | - > | Rhino Linux | [Pacstall Packages] | `pacstall -I zoxide-deb` | - > | Rocky Linux | | `dnf install zoxide` | - > | Slackware 15.0+ | [SlackBuilds] | [Instructions][slackbuilds-howto] | - > | Solus | [Solus Packages] | `eopkg install zoxide` | - > | ~Ubuntu 21.04+~[^1] | ~[Ubuntu Packages]~ | ~`apt install zoxide`~ | - > | Void Linux | [Void Linux Packages] | `xbps-install -S zoxide` | + > | Distribution | Repository | Instructions | + > | ------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------- | + > | **_Any_** | **[crates.io]** | `cargo install zoxide --locked` | + > | _Any_ | [asdf] | `asdf plugin add zoxide https://github.com/nyrst/asdf-zoxide.git`
`asdf install zoxide latest` | + > | _Any_ | [conda-forge] | `conda install -c conda-forge zoxide` | + > | _Any_ | [guix] | `guix install zoxide` | + > | _Any_ | [Linuxbrew] | `brew install zoxide` | + > | _Any_ | [nixpkgs] | `nix-env -iA nixpkgs.zoxide` | + > | AlmaLinux | | `dnf install zoxide` | + > | Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` | + > | Arch Linux | [Arch Linux Extra] | `pacman -S zoxide` | + > | CentOS Stream | | `dnf install zoxide` | + > | ~Debian 11+~[^1] | ~[Debian Packages]~ | ~`apt install zoxide`~ | + > | Devuan 4.0+ | [Devuan Packages] | `apt install zoxide` | + > | Exherbo Linux | [Exherbo packages] | `cave resolve -x repository/rust`
`cave resolve -x zoxide` | + > | Fedora 32+ | [Fedora Packages] | `dnf install zoxide` | + > | Gentoo | [Gentoo Packages] | `emerge app-shells/zoxide` | + > | Linux Mint | [apt.cli.rs] (unofficial) | [Setup the repository][apt.cli.rs-setup], then `apt install zoxide` | + > | Manjaro | | `pacman -S zoxide` | + > | openSUSE Tumbleweed | [openSUSE Factory] | `zypper install zoxide` | + > | ~Parrot OS~[^1] | | ~`apt install zoxide`~ | + > | ~Raspbian 11+~[^1] | ~[Raspbian Packages]~ | ~`apt install zoxide`~ | + > | RHEL 8+ | | `dnf install zoxide` | + > | Rhino Linux | [Pacstall Packages] | `pacstall -I zoxide-deb` | + > | Rocky Linux | | `dnf install zoxide` | + > | Slackware 15.0+ | [SlackBuilds] | [Instructions][slackbuilds-howto] | + > | Solus | [Solus Packages] | `eopkg install zoxide` | + > | Ubuntu | [apt.cli.rs] (unofficial) | [Setup the repository][apt.cli.rs-setup], then `apt install zoxide` | + > | Void Linux | [Void Linux Packages] | `xbps-install -S zoxide` | @@ -280,6 +281,18 @@ zoxide can be installed in 4 easy steps: +
+ Tcsh + + > Add this to the **end** of your config file (usually `~/.tcshrc`): + > + > ```sh + > zoxide init tcsh > ~/.zoxide.tcsh + > source ~/.zoxide.tcsh + > ``` + +
+
Xonsh @@ -323,7 +336,7 @@ zoxide can be installed in 4 easy steps: interactive selection. It can be installed from [here][fzf-installation]. > **Note** - > zoxide only supports fzf v0.33.0 and above. + > The minimum supported fzf version is v0.51.0. 4. **Import your data** (optional) @@ -461,6 +474,7 @@ Environment variables[^2] can be used for configuration. They must be set before | [lf] | File manager | See the [wiki][lf-wiki] | | [nnn] | File manager | [nnn-autojump] | | [ranger] | File manager | [ranger-zoxide] | +| [raycast] | macOS launcher | [raycast-zoxide] | | [rfm] | File manager | Natively supported | | [sesh] | `tmux` session manager | Natively supported | | [telescope.nvim] | Fuzzy finder for Neovim | [telescope-zoxide] | @@ -475,7 +489,7 @@ Environment variables[^2] can be used for configuration. They must be set before | [zsh-autocomplete] | Realtime completions for zsh | Natively supported | [^1]: - Debian / Ubuntu derivatives update their packages very slowly. If you're + Debian and its derivatives update their packages very slowly. If you're using one of these distributions, consider using the install script instead. [^2]: @@ -488,6 +502,8 @@ Environment variables[^2] can be used for configuration. They must be set before [algorithm-aging]: https://github.com/ajeetdsouza/zoxide/wiki/Algorithm#aging [algorithm-matching]: https://github.com/ajeetdsouza/zoxide/wiki/Algorithm#matching [alpine linux packages]: https://pkgs.alpinelinux.org/packages?name=zoxide +[apt.cli.rs]: https://apt.cli.rs/ +[apt.cli.rs-setup]: https://github.com/emmatyping/apt.cli.rs#how-to-add-the-repo [arch linux extra]: https://archlinux.org/packages/extra/x86_64/zoxide/ [asdf]: https://github.com/asdf-vm/asdf [builtwithnix-badge]: https://img.shields.io/badge/builtwith-nix-7d81f7?logo=nixos&logoColor=white&style=flat-square @@ -521,7 +537,7 @@ Environment variables[^2] can be used for configuration. They must be set before [linuxbrew]: https://formulae.brew.sh/formula-linux/zoxide [macports]: https://ports.macports.org/port/zoxide/summary [neovim]: https://github.com/neovim/neovim -[nixpkgs]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/zoxide/default.nix +[nixpkgs]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/zo/zoxide/package.nix [nnn-autojump]: https://github.com/jarun/nnn/blob/master/plugins/autojump [nnn]: https://github.com/jarun/nnn [opensuse factory]: https://build.opensuse.org/package/show/openSUSE:Factory/zoxide @@ -530,6 +546,8 @@ Environment variables[^2] can be used for configuration. They must be set before [ranger-zoxide]: https://github.com/jchook/ranger-zoxide [ranger]: https://github.com/ranger/ranger [raspbian packages]: https://archive.raspbian.org/raspbian/pool/main/r/rust-zoxide/ +[raycast]: https://www.raycast.com/ +[raycast-zoxide]: https://www.raycast.com/mrpunkin/raycast-zoxide [releases]: https://github.com/ajeetdsouza/zoxide/releases [rfm]: https://github.com/dsxmachina/rfm [scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json @@ -543,7 +561,6 @@ Environment variables[^2] can be used for configuration. They must be set before [tmux-session-wizard]: https://github.com/27medkamal/tmux-session-wizard [tmux-sessionx]: https://github.com/omerxx/tmux-sessionx [tutorial]: contrib/tutorial.webp -[ubuntu packages]: https://packages.ubuntu.com/jammy/zoxide [vim]: https://github.com/vim/vim [void linux packages]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/zoxide [wiki-env]: https://github.com/ajeetdsouza/zoxide/wiki/HOWTO:-set-environment-variables "HOWTO: set environment variables" diff --git a/build.rs b/build.rs index bf6dbbf..7b3a60f 100644 --- a/build.rs +++ b/build.rs @@ -6,6 +6,7 @@ use std::{env, io}; use clap::CommandFactory as _; use clap_complete::shells::{Bash, Elvish, Fish, PowerShell, Zsh}; use clap_complete_fig::Fig; +use clap_complete_nushell::Nushell; use cmd::Cmd; fn main() -> io::Result<()> { @@ -27,6 +28,7 @@ fn generate_completions() -> io::Result<()> { clap_complete::generate_to(Elvish, cmd, BIN_NAME, OUT_DIR)?; clap_complete::generate_to(Fig, cmd, BIN_NAME, OUT_DIR)?; clap_complete::generate_to(Fish, cmd, BIN_NAME, OUT_DIR)?; + clap_complete::generate_to(Nushell, cmd, BIN_NAME, OUT_DIR)?; clap_complete::generate_to(PowerShell, cmd, BIN_NAME, OUT_DIR)?; clap_complete::generate_to(Zsh, cmd, BIN_NAME, OUT_DIR)?; diff --git a/contrib/completions/_zoxide b/contrib/completions/_zoxide index e507bcc..d71253e 100644 --- a/contrib/completions/_zoxide +++ b/contrib/completions/_zoxide @@ -30,6 +30,8 @@ _zoxide() { case $line[1] in (add) _arguments "${_arguments_options[@]}" : \ +'-s+[The rank to increment the entry if it exists or initialize it with if it doesn'\''t]:SCORE:_default' \ +'--score=[The rank to increment the entry if it exists or initialize it with if it doesn'\''t]:SCORE:_default' \ '-h[Print help]' \ '--help[Print help]' \ '-V[Print version]' \ @@ -59,7 +61,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -':path:' \ +':path:_default' \ && ret=0 ;; (delete) @@ -68,7 +70,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -':path:' \ +':path:_default' \ && ret=0 ;; (increment) @@ -77,7 +79,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -':path:' \ +':path:_default' \ && ret=0 ;; (reload) @@ -105,19 +107,20 @@ _arguments "${_arguments_options[@]}" : \ ;; (init) _arguments "${_arguments_options[@]}" : \ -'--cmd=[Changes the prefix of the \`z\` and \`zi\` commands]:CMD: ' \ +'--cmd=[Changes the prefix of the \`z\` and \`zi\` commands]:CMD:_default' \ '--hook=[Changes how often zoxide increments a directory'\''s score]:HOOK:(none prompt pwd)' \ '--no-cmd[Prevents zoxide from defining the \`z\` and \`zi\` commands]' \ '-h[Print help]' \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -':shell:(bash elvish fish nushell posix powershell xonsh zsh)' \ +':shell:(bash elvish fish nushell posix powershell tcsh xonsh zsh)' \ && ret=0 ;; (query) _arguments "${_arguments_options[@]}" : \ '--exclude=[Exclude the current directory]:path:_files -/' \ +'--base-dir=[Only search within this directory]:path:_files -/' \ '-a[Show unavailable directories]' \ '--all[Show unavailable directories]' \ '(-l --list)-i[Use interactive selection]' \ @@ -130,7 +133,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -'*::keywords:' \ +'*::keywords:_default' \ && ret=0 ;; (remove) @@ -148,7 +151,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -':bookmark_id:' \ +':bookmark_id:_default' \ ':path:_files -/' \ && ret=0 ;; diff --git a/contrib/completions/_zoxide.ps1 b/contrib/completions/_zoxide.ps1 index b1335d0..d8f278f 100644 --- a/contrib/completions/_zoxide.ps1 +++ b/contrib/completions/_zoxide.ps1 @@ -35,6 +35,8 @@ Register-ArgumentCompleter -Native -CommandName 'zoxide' -ScriptBlock { break } 'zoxide;add' { + [CompletionResult]::new('-s', '-s', [CompletionResultType]::ParameterName, 'The rank to increment the entry if it exists or initialize it with if it doesn''t') + [CompletionResult]::new('--score', '--score', [CompletionResultType]::ParameterName, 'The rank to increment the entry if it exists or initialize it with if it doesn''t') [CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help') [CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help') [CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version') @@ -101,6 +103,7 @@ Register-ArgumentCompleter -Native -CommandName 'zoxide' -ScriptBlock { } 'zoxide;query' { [CompletionResult]::new('--exclude', '--exclude', [CompletionResultType]::ParameterName, 'Exclude the current directory') + [CompletionResult]::new('--base-dir', '--base-dir', [CompletionResultType]::ParameterName, 'Only search within this directory') [CompletionResult]::new('-a', '-a', [CompletionResultType]::ParameterName, 'Show unavailable directories') [CompletionResult]::new('--all', '--all', [CompletionResultType]::ParameterName, 'Show unavailable directories') [CompletionResult]::new('-i', '-i', [CompletionResultType]::ParameterName, 'Use interactive selection') diff --git a/contrib/completions/zoxide.bash b/contrib/completions/zoxide.bash index b47d110..5950f88 100644 --- a/contrib/completions/zoxide.bash +++ b/contrib/completions/zoxide.bash @@ -1,12 +1,16 @@ _zoxide() { local i cur prev opts cmd COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" + if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then + cur="$2" + else + cur="${COMP_WORDS[COMP_CWORD]}" + fi + prev="$3" cmd="" opts="" - for i in ${COMP_WORDS[@]} + for i in "${COMP_WORDS[@]:0:COMP_CWORD}" do case "${cmd},${i}" in ",$1") @@ -66,12 +70,20 @@ _zoxide() { return 0 ;; zoxide__add) - opts="-h -V --help --version ..." + opts="-s -h -V --score --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in + --score) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -s) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; *) COMPREPLY=() ;; @@ -182,7 +194,7 @@ _zoxide() { return 0 ;; zoxide__init) - opts="-h -V --no-cmd --cmd --hook --help --version bash elvish fish nushell posix powershell xonsh zsh" + opts="-h -V --no-cmd --cmd --hook --help --version bash elvish fish nushell posix powershell tcsh xonsh zsh" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -204,7 +216,7 @@ _zoxide() { return 0 ;; zoxide__query) - opts="-a -i -l -s -h -V --all --interactive --list --score --exclude --help --version [KEYWORDS]..." + opts="-a -i -l -s -h -V --all --interactive --list --score --exclude --base-dir --help --version [KEYWORDS]..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -217,6 +229,13 @@ _zoxide() { fi return 0 ;; + --base-dir) + COMPREPLY=() + if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then + compopt -o plusdirs + fi + return 0 + ;; *) COMPREPLY=() ;; diff --git a/contrib/completions/zoxide.elv b/contrib/completions/zoxide.elv index 0ef1686..aa8aaef 100644 --- a/contrib/completions/zoxide.elv +++ b/contrib/completions/zoxide.elv @@ -31,6 +31,8 @@ set edit:completion:arg-completer[zoxide] = {|@words| cand bookmark 'bookmark' } &'zoxide;add'= { + cand -s 'The rank to increment the entry if it exists or initialize it with if it doesn''t' + cand --score 'The rank to increment the entry if it exists or initialize it with if it doesn''t' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' @@ -89,6 +91,7 @@ set edit:completion:arg-completer[zoxide] = {|@words| } &'zoxide;query'= { cand --exclude 'Exclude the current directory' + cand --base-dir 'Only search within this directory' cand -a 'Show unavailable directories' cand --all 'Show unavailable directories' cand -i 'Use interactive selection' diff --git a/contrib/completions/zoxide.fish b/contrib/completions/zoxide.fish index f29c8f9..d4cda55 100644 --- a/contrib/completions/zoxide.fish +++ b/contrib/completions/zoxide.fish @@ -33,6 +33,7 @@ complete -c zoxide -n "__fish_zoxide_needs_command" -f -a "init" -d 'Generate sh complete -c zoxide -n "__fish_zoxide_needs_command" -f -a "query" -d 'Search for a directory in the database' complete -c zoxide -n "__fish_zoxide_needs_command" -f -a "remove" -d 'Remove a directory from the database' complete -c zoxide -n "__fish_zoxide_needs_command" -f -a "bookmark" +complete -c zoxide -n "__fish_zoxide_using_subcommand add" -s s -l score -d 'The rank to increment the entry if it exists or initialize it with if it doesn\'t' -r complete -c zoxide -n "__fish_zoxide_using_subcommand add" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_zoxide_using_subcommand add" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_zoxide_using_subcommand edit; and not __fish_seen_subcommand_from decrement delete increment reload" -s h -l help -d 'Print help' @@ -49,16 +50,20 @@ complete -c zoxide -n "__fish_zoxide_using_subcommand edit; and __fish_seen_subc complete -c zoxide -n "__fish_zoxide_using_subcommand edit; and __fish_seen_subcommand_from increment" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_zoxide_using_subcommand edit; and __fish_seen_subcommand_from reload" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_zoxide_using_subcommand edit; and __fish_seen_subcommand_from reload" -s V -l version -d 'Print version' -complete -c zoxide -n "__fish_zoxide_using_subcommand import" -l from -d 'Application to import from' -r -f -a "{autojump\t'',z\t''}" +complete -c zoxide -n "__fish_zoxide_using_subcommand import" -l from -d 'Application to import from' -r -f -a "autojump\t'' +z\t''" complete -c zoxide -n "__fish_zoxide_using_subcommand import" -l merge -d 'Merge into existing database' complete -c zoxide -n "__fish_zoxide_using_subcommand import" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_zoxide_using_subcommand import" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_zoxide_using_subcommand init" -l cmd -d 'Changes the prefix of the `z` and `zi` commands' -r -complete -c zoxide -n "__fish_zoxide_using_subcommand init" -l hook -d 'Changes how often zoxide increments a directory\'s score' -r -f -a "{none\t'',prompt\t'',pwd\t''}" +complete -c zoxide -n "__fish_zoxide_using_subcommand init" -l hook -d 'Changes how often zoxide increments a directory\'s score' -r -f -a "none\t'' +prompt\t'' +pwd\t''" complete -c zoxide -n "__fish_zoxide_using_subcommand init" -l no-cmd -d 'Prevents zoxide from defining the `z` and `zi` commands' complete -c zoxide -n "__fish_zoxide_using_subcommand init" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_zoxide_using_subcommand init" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_zoxide_using_subcommand query" -l exclude -d 'Exclude the current directory' -r -f -a "(__fish_complete_directories)" +complete -c zoxide -n "__fish_zoxide_using_subcommand query" -l base-dir -d 'Only search within this directory' -r -f -a "(__fish_complete_directories)" complete -c zoxide -n "__fish_zoxide_using_subcommand query" -s a -l all -d 'Show unavailable directories' complete -c zoxide -n "__fish_zoxide_using_subcommand query" -s i -l interactive -d 'Use interactive selection' complete -c zoxide -n "__fish_zoxide_using_subcommand query" -s l -l list -d 'List all matching directories' diff --git a/contrib/completions/zoxide.nu b/contrib/completions/zoxide.nu new file mode 100644 index 0000000..d5ee07b --- /dev/null +++ b/contrib/completions/zoxide.nu @@ -0,0 +1,106 @@ +module completions { + + # A smarter cd command for your terminal + export extern zoxide [ + --help(-h) # Print help + --version(-V) # Print version + ] + + # Add a new directory or increment its rank + export extern "zoxide add" [ + ...paths: path + --score(-s): string # The rank to increment the entry if it exists or initialize it with if it doesn't + --help(-h) # Print help + --version(-V) # Print version + ] + + # Edit the database + export extern "zoxide edit" [ + --help(-h) # Print help + --version(-V) # Print version + ] + + export extern "zoxide edit decrement" [ + path: string + --help(-h) # Print help + --version(-V) # Print version + ] + + export extern "zoxide edit delete" [ + path: string + --help(-h) # Print help + --version(-V) # Print version + ] + + export extern "zoxide edit increment" [ + path: string + --help(-h) # Print help + --version(-V) # Print version + ] + + export extern "zoxide edit reload" [ + --help(-h) # Print help + --version(-V) # Print version + ] + + def "nu-complete zoxide import from" [] { + [ "autojump" "z" ] + } + + # Import entries from another application + export extern "zoxide import" [ + path: path + --from: string@"nu-complete zoxide import from" # Application to import from + --merge # Merge into existing database + --help(-h) # Print help + --version(-V) # Print version + ] + + def "nu-complete zoxide init shell" [] { + [ "bash" "elvish" "fish" "nushell" "posix" "powershell" "tcsh" "xonsh" "zsh" ] + } + + def "nu-complete zoxide init hook" [] { + [ "none" "prompt" "pwd" ] + } + + # Generate shell configuration + export extern "zoxide init" [ + shell: string@"nu-complete zoxide init shell" + --no-cmd # Prevents zoxide from defining the `z` and `zi` commands + --cmd: string # Changes the prefix of the `z` and `zi` commands + --hook: string@"nu-complete zoxide init hook" # Changes how often zoxide increments a directory's score + --help(-h) # Print help + --version(-V) # Print version + ] + + # Search for a directory in the database + export extern "zoxide query" [ + ...keywords: string + --all(-a) # Show unavailable directories + --interactive(-i) # Use interactive selection + --list(-l) # List all matching directories + --score(-s) # Print score with results + --exclude: path # Exclude the current directory + --base-dir: path # Only search within this directory + --help(-h) # Print help + --version(-V) # Print version + ] + + # Remove a directory from the database + export extern "zoxide remove" [ + ...paths: path + --help(-h) # Print help + --version(-V) # Print version + ] + + export extern "zoxide bookmark" [ + bookmark_id: string + path: path + --help(-h) # Print help + --version(-V) # Print version + ] + +} + +export use completions * diff --git a/contrib/completions/zoxide.ts b/contrib/completions/zoxide.ts index cafd3db..a7304fc 100644 --- a/contrib/completions/zoxide.ts +++ b/contrib/completions/zoxide.ts @@ -6,6 +6,15 @@ const completion: Fig.Spec = { name: "add", description: "Add a new directory or increment its rank", options: [ + { + name: ["-s", "--score"], + description: "The rank to increment the entry if it exists or initialize it with if it doesn't", + isRepeatable: true, + args: { + name: "score", + isOptional: true, + }, + }, { name: ["-h", "--help"], description: "Print help", @@ -185,6 +194,7 @@ const completion: Fig.Spec = { "nushell", "posix", "powershell", + "tcsh", "xonsh", "zsh", ], @@ -204,6 +214,16 @@ const completion: Fig.Spec = { template: "folders", }, }, + { + name: "--base-dir", + description: "Only search within this directory", + isRepeatable: true, + args: { + name: "base_dir", + isOptional: true, + template: "folders", + }, + }, { name: ["-a", "--all"], description: "Show unavailable directories", diff --git a/man/man1/zoxide-init.1 b/man/man1/zoxide-init.1 index 387c318..ebf1ed1 100644 --- a/man/man1/zoxide-init.1 +++ b/man/man1/zoxide-init.1 @@ -55,6 +55,14 @@ $profile\fR in PowerShell): \fBInvoke-Expression (& { (zoxide init powershell | Out-String) })\fR .fi .TP +.B tcsh +Add this to the \fBend\fR of your config file (usually \fB~/.tcshrc\fR): +.sp +.nf + \fBzoxide init tcsh > ~/.zoxide.tcsh\fR + \fBsource ~/.zoxide.tcsh\fR +.fi +.TP .B xonsh Add this to the \fBend\fR of your config file (usually \fB~/.xonshrc\fR): .sp diff --git a/shell.nix b/shell.nix index b63d44c..b7b7400 100644 --- a/shell.nix +++ b/shell.nix @@ -1,10 +1,10 @@ let pkgs = import (builtins.fetchTarball - "https://github.com/NixOS/nixpkgs/archive/056faf24027e12f0ba6edebe299ed136e030d29a.tar.gz") { + "https://github.com/NixOS/nixpkgs/archive/ec9ef366451af88284d7dfd18ee017b7e86a0710.tar.gz") { overlays = [ rust ]; }; rust = import (builtins.fetchTarball - "https://github.com/oxalica/rust-overlay/archive/f61820fa2c3844d6940cce269a6afdec30aa2e6c.tar.gz"); + "https://github.com/oxalica/rust-overlay/archive/026e8fedefd6b167d92ed04b195c658d95ffc7a5.tar.gz"); rust-nightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal); @@ -27,6 +27,7 @@ in pkgs.mkShell { pkgs.ksh pkgs.nushell pkgs.powershell + pkgs.tcsh pkgs.xonsh pkgs.zsh diff --git a/src/cmd/add.rs b/src/cmd/add.rs index e7d6e0b..302ae0a 100644 --- a/src/cmd/add.rs +++ b/src/cmd/add.rs @@ -33,7 +33,9 @@ impl Run for Add { if !Path::new(path).is_dir() { bail!("not a directory: {path}"); } - db.add_update(path, 1.0, now); + + let by = self.score.unwrap_or(1.0); + db.add_update(path, by, now); } if db.dirty() { diff --git a/src/cmd/cmd.rs b/src/cmd/cmd.rs index f926277..129d3fd 100644 --- a/src/cmd/cmd.rs +++ b/src/cmd/cmd.rs @@ -59,6 +59,11 @@ pub enum Cmd { pub struct Add { #[clap(num_args = 1.., required = true, value_hint = ValueHint::DirPath)] pub paths: Vec, + + /// The rank to increment the entry if it exists or initialize it with if it + /// doesn't + #[clap(short, long)] + pub score: Option, } /// Edit the database @@ -149,6 +154,7 @@ pub enum InitShell { #[clap(alias = "ksh")] Posix, Powershell, + Tcsh, Xonsh, Zsh, } @@ -181,6 +187,10 @@ pub struct Query { /// Exclude the current directory #[clap(long, value_hint = ValueHint::DirPath, value_name = "path")] pub exclude: Option, + + /// Only search within this directory + #[clap(long, value_hint = ValueHint::DirPath, value_name = "path")] + pub base_dir: Option, } /// Remove a directory from the database diff --git a/src/cmd/init.rs b/src/cmd/init.rs index 3f79ed6..980513e 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -1,12 +1,12 @@ use std::io::{self, Write}; use anyhow::{Context, Result}; -use rinja::Template; +use askama::Template; use crate::cmd::{Init, InitShell, Run}; use crate::config; use crate::error::BrokenPipeHandler; -use crate::shell::{Bash, Elvish, Fish, Nushell, Opts, Posix, Powershell, Xonsh, Zsh}; +use crate::shell::{Bash, Elvish, Fish, Nushell, Opts, Posix, Powershell, Tcsh, Xonsh, Zsh}; impl Run for Init { fn run(&self) -> Result<()> { @@ -22,6 +22,7 @@ impl Run for Init { InitShell::Nushell => Nushell(opts).render(), InitShell::Posix => Posix(opts).render(), InitShell::Powershell => Powershell(opts).render(), + InitShell::Tcsh => Tcsh(opts).render(), InitShell::Xonsh => Xonsh(opts).render(), InitShell::Zsh => Zsh(opts).render(), } diff --git a/src/cmd/query.rs b/src/cmd/query.rs index 08f3c8b..4d2d1af 100644 --- a/src/cmd/query.rs +++ b/src/cmd/query.rs @@ -101,7 +101,8 @@ impl Query { fn get_stream<'a>(&self, db: &'a mut Database, now: Epoch) -> Result> { let mut options = StreamOptions::new(now) .with_keywords(self.keywords.iter().map(|s| s.as_str())) - .with_exclude(config::exclude_dirs()?); + .with_exclude(config::exclude_dirs()?) + .with_base_dir(self.base_dir.clone()); if !self.all { let resolve_symlinks = config::resolve_symlinks(); options = options.with_exists(true).with_resolve_symlinks(resolve_symlinks); diff --git a/src/db/mod.rs b/src/db/mod.rs index 6074562..d71d4e4 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -190,7 +190,7 @@ impl Database { *self.borrow_dirty() } - pub fn dirs(&self) -> &[Dir] { + pub fn dirs(&self) -> &[Dir<'_>] { &self.borrow_dirs().0 } @@ -223,7 +223,10 @@ impl Database { .context("could not serialize database") } - fn deserialize(bytes: &[u8], path: PathBuf) -> Result<(Vec, HashMap)> { + fn deserialize( + bytes: &[u8], + path: PathBuf, + ) -> Result<(Vec>, HashMap)> { // Assume a maximum size for the database. This prevents bincode from throwing // strange errors when it encounters invalid data. const MAX_SIZE: u64 = 32 << 20; // 32 MiB diff --git a/src/db/stream.rs b/src/db/stream.rs index 38fd598..6ce9761 100644 --- a/src/db/stream.rs +++ b/src/db/stream.rs @@ -1,5 +1,6 @@ use std::iter::Rev; use std::ops::Range; +use std::path::Path; use std::{fs, path}; use glob::Pattern; @@ -20,7 +21,7 @@ impl<'a> Stream<'a> { Stream { db, idxs, options } } - pub fn next(&mut self) -> Option<&Dir> { + pub fn next(&mut self) -> Option<&Dir<'_>> { while let Some(idx) = self.idxs.next() { let dir = &self.db.dirs()[idx]; @@ -28,11 +29,16 @@ impl<'a> Stream<'a> { continue; } + if !self.filter_by_base_dir(&dir.path) { + continue; + } + if !self.filter_by_exclude(&dir.path) { self.db.swap_remove(idx); continue; } + // Exists queries are slow, this should always be checked last. if !self.filter_by_exists(&dir.path) { if dir.last_accessed < self.options.ttl { self.db.swap_remove(idx); @@ -47,6 +53,30 @@ impl<'a> Stream<'a> { None } + fn filter_by_base_dir(&self, path: &str) -> bool { + match &self.options.base_dir { + Some(base_dir) => Path::new(path).starts_with(base_dir), + None => true, + } + } + + fn filter_by_exclude(&self, path: &str) -> bool { + !self.options.exclude.iter().any(|pattern| pattern.matches(path)) + } + + fn filter_by_exists(&self, path: &str) -> bool { + if !self.options.exists { + return true; + } + + // The logic here is reversed - if we resolve symlinks when adding entries to + // the database, we should not return symlinks when querying back from + // the database. + let resolver = + if self.options.resolve_symlinks { fs::symlink_metadata } else { fs::metadata }; + resolver(path).map(|metadata| metadata.is_dir()).unwrap_or_default() + } + fn filter_by_keywords(&self, path: &str) -> bool { let (keywords_last, keywords) = match self.options.keywords.split_last() { Some(split) => split, @@ -74,23 +104,6 @@ impl<'a> Stream<'a> { true } - - fn filter_by_exclude(&self, path: &str) -> bool { - !self.options.exclude.iter().any(|pattern| pattern.matches(path)) - } - - fn filter_by_exists(&self, path: &str) -> bool { - if !self.options.exists { - return true; - } - - // The logic here is reversed - if we resolve symlinks when adding entries to - // the database, we should not return symlinks when querying back from - // the database. - let resolver = - if self.options.resolve_symlinks { fs::symlink_metadata } else { fs::metadata }; - resolver(path).map(|metadata| metadata.is_dir()).unwrap_or_default() - } } pub struct StreamOptions { @@ -112,6 +125,10 @@ pub struct StreamOptions { /// Directories that do not exist and haven't been accessed since TTL will /// be lazily removed. ttl: Epoch, + + /// Only return directories within this parent directory + /// Does not check if the path exists + base_dir: Option, } impl StreamOptions { @@ -123,6 +140,7 @@ impl StreamOptions { exists: false, resolve_symlinks: false, ttl: now.saturating_sub(3 * MONTH), + base_dir: None, } } @@ -149,6 +167,11 @@ impl StreamOptions { self.resolve_symlinks = resolve_symlinks; self } + + pub fn with_base_dir(mut self, base_dir: Option) -> Self { + self.base_dir = base_dir; + self + } } #[cfg(test)] diff --git a/src/main.rs b/src/main.rs index 1ff26f3..d4ddd6e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,8 +18,8 @@ use crate::error::SilentExit; pub fn main() -> ExitCode { // Forcibly disable backtraces. - env::remove_var("RUST_LIB_BACKTRACE"); - env::remove_var("RUST_BACKTRACE"); + unsafe { env::remove_var("RUST_LIB_BACKTRACE") }; + unsafe { env::remove_var("RUST_BACKTRACE") }; match Cmd::parse().run() { Ok(()) => ExitCode::SUCCESS, diff --git a/src/shell.rs b/src/shell.rs index 721553d..37fe1a2 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -10,7 +10,7 @@ pub struct Opts<'a> { macro_rules! make_template { ($name:ident, $path:expr) => { - #[derive(::std::fmt::Debug, ::rinja::Template)] + #[derive(::std::fmt::Debug, ::askama::Template)] #[template(path = $path)] pub struct $name<'a>(pub &'a self::Opts<'a>); @@ -29,14 +29,15 @@ make_template!(Fish, "fish.txt"); make_template!(Nushell, "nushell.txt"); make_template!(Posix, "posix.txt"); make_template!(Powershell, "powershell.txt"); +make_template!(Tcsh, "tcsh.txt"); make_template!(Xonsh, "xonsh.txt"); make_template!(Zsh, "zsh.txt"); #[cfg(feature = "nix-dev")] #[cfg(test)] mod tests { + use askama::Template; use assert_cmd::Command; - use rinja::Template; use rstest::rstest; use rstest_reuse::{apply, template}; @@ -96,7 +97,7 @@ mod tests { #[apply(opts)] fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) { let opts = Opts { cmd, hook, echo, resolve_symlinks }; - let mut source = String::default(); + let mut source = String::new(); // Filter out lines using edit:*, since those functions are only available in // the interactive editor. @@ -248,6 +249,20 @@ mod tests { .stderr(""); } + #[apply(opts)] + fn tcsh_tcsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) { + let opts = Opts { cmd, hook, echo, resolve_symlinks }; + let source = Tcsh(&opts).render().unwrap(); + + Command::new("tcsh") + .args(["-e", "-f", "-s"]) + .write_stdin(source) + .assert() + .success() + .stdout("") + .stderr(""); + } + #[apply(opts)] fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) { let opts = Opts { cmd, hook, echo, resolve_symlinks }; diff --git a/src/util.rs b/src/util.rs index 9f6689d..996f61d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -135,7 +135,7 @@ impl FzfChild { mem::drop(self.0.stdin.take()); let mut stdout = self.0.stdout.take().unwrap(); - let mut output = String::default(); + let mut output = String::new(); stdout.read_to_string(&mut output).context("failed to read from fzf")?; let status = self.0.wait().context("wait failed on fzf")?; @@ -169,16 +169,21 @@ pub fn write(path: impl AsRef, contents: impl AsRef<[u8]>) -> Result<()> { #[cfg(unix)] if let Ok(metadata) = path.metadata() { use std::os::unix::fs::MetadataExt; - use std::os::unix::io::AsRawFd; use nix::unistd::{self, Gid, Uid}; let uid = Uid::from_raw(metadata.uid()); let gid = Gid::from_raw(metadata.gid()); - _ = unistd::fchown(tmp_file.as_raw_fd(), Some(uid), Some(gid)); + _ = unistd::fchown(&tmp_file, Some(uid), Some(gid)); } // Close and rename the tmpfile. + // In some cases, errors from the last write() are reported only on close(). + // Rust ignores errors from close(), since it occurs inside `Drop`. To + // catch these errors, we manually call `File::sync_all()` first. + tmp_file + .sync_all() + .with_context(|| format!("could not sync writes to file: {}", tmp_path.display()))?; mem::drop(tmp_file); rename(&tmp_path, path) })(); diff --git a/templates/bash.txt b/templates/bash.txt index a4177a8..84be3a0 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -66,8 +66,11 @@ function __zoxide_doctor() { return 0 {%- else %} - [[ ${_ZO_DOCTOR:-1} -ne 0 ]] || return 0 - [[ ${PROMPT_COMMAND:=} != *'__zoxide_hook'* ]] || return 0 + [[ ${_ZO_DOCTOR:-1} -eq 0 ]] && return 0 + # shellcheck disable=SC2199 + [[ ${PROMPT_COMMAND[@]:-} == *'__zoxide_hook'* ]] && return 0 + # shellcheck disable=SC2199 + [[ ${__vsc_original_prompt_command[@]:-} == *'__zoxide_hook'* ]] && return 0 _ZO_DOCTOR=0 \builtin printf '%s\n' \ @@ -86,6 +89,8 @@ function __zoxide_doctor() { # When using zoxide with --no-cmd, alias these internal functions as desired. # +__zoxide_z_prefix='z#' + # Jump to a directory using only keywords. function __zoxide_z() { __zoxide_doctor @@ -99,6 +104,10 @@ function __zoxide_z() { __zoxide_cd "$1" elif [[ $# -eq 2 && $1 == '--' ]]; then __zoxide_cd "$2" + elif [[ ${@: -1} == "${__zoxide_z_prefix}"?* ]]; then + # shellcheck disable=SC2124 + \builtin local result="${@: -1}" + __zoxide_cd "{{ "${result:${#__zoxide_z_prefix}}" }}" else \builtin local result # shellcheck disable=SC2312 @@ -142,6 +151,8 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER function __zoxide_z_complete_helper() { READLINE_LINE="{{ cmd }} ${__zoxide_result@Q}" READLINE_POINT={{ "${#READLINE_LINE}" }} + bind '"\e[0n": accept-line' + \builtin printf '\e[5n' >/dev/tty } function __zoxide_z_complete() { @@ -157,11 +168,16 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER elif [[ -z ${COMP_WORDS[-1]} ]]; then # shellcheck disable=SC2312 __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" && { - \builtin bind '"\e[0n": redraw-current-line' - \builtin printf '\e[5n' + # In case the terminal does not respond to \e[5n or another + # mechanism steals the response, it is still worth completing + # the directory in the command line. + COMPREPLY=("${__zoxide_z_prefix}${__zoxide_result}/") - \builtin bind -x '"\e[0n": __zoxide_z_complete_helper "${result}"' - \builtin printf '\e[5n' + # Note: We here call "bind" without prefixing "\builtin" to be + # compatible with frameworks like ble.sh, which emulates Bash's + # builtin "bind". + bind -x '"\e[0n": __zoxide_z_complete_helper' + \builtin printf '\e[5n' >/dev/tty } fi } diff --git a/templates/nushell.txt b/templates/nushell.txt index 67285f7..4153b39 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -26,7 +26,7 @@ export-env { if not $__zoxide_hooked { $env.config.hooks.pre_prompt = ($env.config.hooks.pre_prompt | append { __zoxide_hook: true, - code: {|| zoxide add -- $env.PWD} + code: {|| ^zoxide add -- $env.PWD} }) } {%- else if hook == InitHook::Pwd %} @@ -43,7 +43,7 @@ export-env { if not $__zoxide_hooked { $env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append { __zoxide_hook: true, - code: {|_, dir| zoxide add -- $dir} + code: {|_, dir| ^zoxide add -- $dir} }) } {%- endif %} @@ -60,9 +60,9 @@ def --env --wrapped __zoxide_z [...rest: string] { let path = match $rest { [] => {'~'}, [ '-' ] => {'-'}, - [ $arg ] if ($arg | path type) == 'dir' => {$arg} + [ $arg ] if ($arg | path expand | path type) == 'dir' => {$arg} _ => { - zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n" + ^zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n" } } cd $path @@ -73,7 +73,7 @@ def --env --wrapped __zoxide_z [...rest: string] { # Jump to a directory using interactive search. def --env --wrapped __zoxide_zi [...rest:string] { - cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")' + cd $'(^zoxide query --interactive -- ...$rest | str trim -r -c "\n")' {%- if echo %} echo $env.PWD {%- endif %} diff --git a/templates/posix.txt b/templates/posix.txt index a1793ad..b7ba9b3 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -43,6 +43,30 @@ if [ "${PS1:=}" = "${PS1#*\$(__zoxide_hook)}" ]; then PS1="${PS1}\$(__zoxide_hook)" fi +# Report common issues. +__zoxide_doctor() { +{%- if hook != InitHook::Prompt %} + return 0 +{%- else %} + [ "${_ZO_DOCTOR:-1}" -eq 0 ] && return 0 + case "${PS1:-}" in + *__zoxide_hook*) return 0 ;; + *) ;; + esac + + _ZO_DOCTOR=0 + \command printf '%s\n' \ + 'zoxide: detected a possible configuration issue.' \ + 'Please ensure that zoxide is initialized right at the end of your shell configuration file.' \ + '' \ + 'If the issue persists, consider filing an issue at:' \ + 'https://github.com/ajeetdsouza/zoxide/issues' \ + '' \ + 'Disable this message by setting _ZO_DOCTOR=0.' \ + '' >&2 +{%- endif %} +} + {%- when InitHook::Pwd -%} \command printf "%s\n%s\n" \ "zoxide: PWD hooks are not supported on POSIX shells." \ @@ -56,6 +80,8 @@ fi # Jump to a directory using only keywords. __zoxide_z() { + __zoxide_doctor + if [ "$#" -eq 0 ]; then __zoxide_cd ~ elif [ "$#" -eq 1 ] && [ "$1" = '-' ]; then @@ -76,6 +102,7 @@ __zoxide_z() { # Jump to a directory using interactive search. __zoxide_zi() { + __zoxide_doctor __zoxide_result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${__zoxide_result}" } diff --git a/templates/powershell.txt b/templates/powershell.txt index 86b1966..046061c 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -80,7 +80,7 @@ function global:__zoxide_hook { {%- endif %} # Initialize hook. -$global:__zoxide_hooked = (Get-Variable __zoxide_hooked -ErrorAction SilentlyContinue -ValueOnly) +$global:__zoxide_hooked = (Get-Variable __zoxide_hooked -ErrorAction Ignore -ValueOnly) if ($global:__zoxide_hooked -ne 1) { $global:__zoxide_hooked = 1 $global:__zoxide_prompt_old = $function:prompt @@ -106,9 +106,12 @@ function global:__zoxide_z { elseif ($args.Length -eq 1 -and ($args[0] -eq '-' -or $args[0] -eq '+')) { __zoxide_cd $args[0] $false } - elseif ($args.Length -eq 1 -and (Test-Path $args[0] -PathType Container)) { + elseif ($args.Length -eq 1 -and (Test-Path -PathType Container -LiteralPath $args[0])) { __zoxide_cd $args[0] $true } + elseif ($args.Length -eq 1 -and (Test-Path -PathType Container -Path $args[0] )) { + __zoxide_cd $args[0] $false + } else { $result = __zoxide_pwd if ($null -ne $result) { diff --git a/templates/tcsh.txt b/templates/tcsh.txt new file mode 100644 index 0000000..b0559a0 --- /dev/null +++ b/templates/tcsh.txt @@ -0,0 +1,74 @@ +{%- let section = "# =============================================================================\n#" -%} +{%- let not_configured = "# -- not configured --" -%} + +{%- let pwd_cmd -%} +{%- if resolve_symlinks -%} +{%- let pwd_cmd = "pwd -P" -%} +{%- else -%} +{%- let pwd_cmd = "pwd -L" -%} +{%- endif -%} + +{{ section }} +# Hook configuration for zoxide. +# +{%- if hook != InitHook::None %} + +# Hook to add new entries to the database. +{%- if hook == InitHook::Prompt %} +alias __zoxide_hook 'zoxide add -- "`{{ pwd_cmd }}`"' + +{%- else if hook == InitHook::Pwd %} +set __zoxide_pwd_old = `{{ pwd_cmd }}` +alias __zoxide_hook 'set __zoxide_pwd_tmp = "`{{ pwd_cmd }}`"; test "$__zoxide_pwd_tmp" != "$__zoxide_pwd_old" && zoxide add -- "$__zoxide_pwd_tmp"; set __zoxide_pwd_old = "$__zoxide_pwd_tmp"' +{%- endif %} + +# Initialize hook. +alias precmd ';__zoxide_hook' + +{%- endif %} + +{{ section }} +# When using zoxide with --no-cmd, alias these internal functions as desired. +# + +# Jump to a directory using only keywords. +alias __zoxide_z 'set __zoxide_args = (\!*)\ +if ("$#__zoxide_args" == 0) then\ + cd ~\ +else\ + if ("$#__zoxide_args" == 1 && "$__zoxide_args[1]" == "-") then\ + cd -\ + else if ("$#__zoxide_args" == 1 && -d "$__zoxide_args[1]") then\ + cd "$__zoxide_args[1]"\ + else\ + set __zoxide_pwd = `{{ pwd_cmd }}`\ + set __zoxide_result = "`zoxide query --exclude '"'"'$__zoxide_pwd'"'"' -- $__zoxide_args`" && cd "$__zoxide_result"\ + endif\ +endif' + +# Jump to a directory using interactive search. +alias __zoxide_zi 'set __zoxide_args = (\!*)\ +set __zoxide_pwd = `{{ pwd_cmd }}`\ +set __zoxide_result = "`zoxide query --exclude '"'"'$__zoxide_pwd'"'"' --interactive -- $__zoxide_args`" && cd "$__zoxide_result"' + +{{ section }} +# Commands for zoxide. Disable these using --no-cmd. +# + +{%- match cmd %} +{%- when Some with (cmd) %} + +alias {{cmd}} __zoxide_z +alias {{cmd}}i __zoxide_zi + +{%- when None %} + +{{ not_configured }} + +{%- endmatch %} + +{{ section }} +# To initialize zoxide, add this to your shell configuration file (usually ~/.tcshrc): +# +# zoxide init tcsh > ~/.zoxide.tcsh +# source ~/.zoxide.tcsh diff --git a/templates/xonsh.txt b/templates/xonsh.txt index c769795..f5c92f2 100644 --- a/templates/xonsh.txt +++ b/templates/xonsh.txt @@ -64,7 +64,7 @@ class ZoxideSilentException(Exception): def __zoxide_errhandler( - func: typing.Callable[[list[str]], None] + func: typing.Callable[[list[str]], None], ) -> typing.Callable[[list[str]], int]: """Print exception and exit with error code 1.""" diff --git a/templates/zsh.txt b/templates/zsh.txt index 631251a..80cd428 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -84,7 +84,7 @@ function __zoxide_z() { __zoxide_doctor if [[ "$#" -eq 0 ]]; then __zoxide_cd ~ - elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then + elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]+$ ]]; }; then __zoxide_cd "$1" elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then __zoxide_cd "$2"