diff --git a/.cargo/config.toml b/.cargo/config.toml
index 4b40e31f..626e366b 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,6 +1,3 @@
-[alias]
-xtask = "run --package xtask --"
-
# On Windows MSVC, statically link the C runtime so that the resulting EXE does
# not depend on the vcruntime DLL.
[target.'cfg(all(windows, target_env = "msvc"))']
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..b18438dc
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{md,rst,txt}]
+indent_size = unset
+trim_trailing_whitespace = false
+
+[*.{nix,ts,yml}]
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
index a9a91a25..eeb6151f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,4 @@
-/contrib/completions/* eol=lf linguist-generated=true text
-/contrib/completions/README.md -eol -linguist-generated -text
-/init.fish eol=lf text
-/templates/*.txt eol=lf text
-/zoxide.plugin.zsh eol=lf text
+* text=auto eol=lf
+
+/contrib/completions/** linguist-generated
+/contrib/completions/README.md -linguist-generated
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5316048..95f6e62b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
+### Added
+
+- Support for `cmd.exe` (experimental).
+
### Fixed
- zsh: Space-Tab completion repeating output multiple times when matching single
diff --git a/Cargo.lock b/Cargo.lock
index f99bfbe2..3e7459e6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
@@ -19,47 +19,48 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "anstream"
-version = "0.6.12"
+version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540"
+checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
+ "is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
-version = "1.0.6"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
+checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]]
name = "anstyle-parse"
-version = "0.2.3"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
+checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
-version = "1.0.2"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
+checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
-version = "3.0.2"
+version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
+checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
@@ -67,9 +68,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.80"
+version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
+checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "askama"
@@ -92,7 +93,7 @@ dependencies = [
"mime_guess",
"proc-macro2",
"quote",
- "syn 2.0.50",
+ "syn",
]
[[package]]
@@ -136,21 +137,15 @@ dependencies = [
[[package]]
name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "bitflags"
-version = "2.4.2"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bstr"
-version = "1.9.0"
+version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
+checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706"
dependencies = [
"memchr",
"regex-automata",
@@ -165,9 +160,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
-version = "4.5.1"
+version = "4.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
+checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
dependencies = [
"clap_builder",
"clap_derive",
@@ -175,9 +170,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.1"
+version = "4.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
+checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
dependencies = [
"anstream",
"anstyle",
@@ -187,18 +182,18 @@ dependencies = [
[[package]]
name = "clap_complete"
-version = "4.5.1"
+version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c"
+checksum = "d2020fa13af48afc65a9a87335bda648309ab3d154cd03c7ff95b378c7ed39c4"
dependencies = [
"clap",
]
[[package]]
name = "clap_complete_fig"
-version = "4.5.0"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54b3e65f91fabdd23cac3d57d39d5d938b4daabd070c335c006dccb866a61110"
+checksum = "fb4bc503cddc1cd320736fb555d6598309ad07c2ddeaa23891a10ffb759ee612"
dependencies = [
"clap",
"clap_complete",
@@ -206,48 +201,48 @@ dependencies = [
[[package]]
name = "clap_derive"
-version = "4.5.0"
+version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47"
+checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
dependencies = [
- "heck",
+ "heck 0.5.0",
"proc-macro2",
"quote",
- "syn 2.0.50",
+ "syn",
]
[[package]]
name = "clap_lex"
-version = "0.7.0"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
+checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]]
name = "color-print"
-version = "0.3.5"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d"
+checksum = "1ee543c60ff3888934877a5671f45494dd27ed4ba25c6670b9a7576b7ed7a8c0"
dependencies = [
"color-print-proc-macro",
]
[[package]]
name = "color-print-proc-macro"
-version = "0.3.5"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f"
+checksum = "77ff1a80c5f3cb1ca7c06ffdd71b6a6dd6d8f896c42141fbd43f50ed28dcdb93"
dependencies = [
"nom",
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn",
]
[[package]]
name = "colorchoice"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
+checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "difflib"
@@ -290,15 +285,15 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
[[package]]
name = "either"
-version = "1.10.0"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
+checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
[[package]]
name = "errno"
-version = "0.3.8"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
+checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
"windows-sys 0.52.0",
@@ -306,15 +301,15 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "2.0.1"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
+checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]]
name = "getrandom"
-version = "0.2.12"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"libc",
@@ -333,6 +328,12 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
[[package]]
name = "home"
version = "0.5.9"
@@ -342,6 +343,12 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
+
[[package]]
name = "itertools"
version = "0.12.1"
@@ -353,32 +360,31 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.154"
+version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libredox"
-version = "0.0.1"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
+checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
- "bitflags 2.4.2",
+ "bitflags",
"libc",
- "redox_syscall",
]
[[package]]
name = "linux-raw-sys"
-version = "0.4.13"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
+checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "memchr"
-version = "2.7.1"
+version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "mime"
@@ -408,7 +414,7 @@ version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
- "bitflags 2.4.2",
+ "bitflags",
"cfg-if",
"libc",
]
@@ -423,12 +429,6 @@ dependencies = [
"minimal-lexical",
]
-[[package]]
-name = "once_cell"
-version = "1.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -437,9 +437,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ouroboros"
-version = "0.18.3"
+version = "0.18.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97b7be5a8a3462b752f4be3ff2b2bf2f7f1d00834902e46be2a4d68b87b0573c"
+checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67"
dependencies = [
"aliasable",
"ouroboros_macro",
@@ -448,16 +448,16 @@ dependencies = [
[[package]]
name = "ouroboros_macro"
-version = "0.18.3"
+version = "0.18.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33"
+checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd"
dependencies = [
- "heck",
+ "heck 0.4.1",
"itertools",
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
- "syn 2.0.50",
+ "syn",
]
[[package]]
@@ -495,9 +495,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.78"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
+checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-ident",
]
@@ -510,16 +510,16 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.50",
+ "syn",
"version_check",
"yansi",
]
[[package]]
name = "quote"
-version = "1.0.35"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
@@ -554,20 +554,11 @@ dependencies = [
"getrandom",
]
-[[package]]
-name = "redox_syscall"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
-dependencies = [
- "bitflags 1.3.2",
-]
-
[[package]]
name = "redox_users"
-version = "0.4.4"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
+checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
dependencies = [
"getrandom",
"libredox",
@@ -576,9 +567,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.10.3"
+version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
+checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [
"aho-corasick",
"memchr",
@@ -588,9 +579,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.5"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
+checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
@@ -599,21 +590,21 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.2"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
+checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "relative-path"
-version = "1.9.2"
+version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc"
+checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2"
[[package]]
name = "rstest"
-version = "0.18.2"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97eeab2f3c0a199bc4be135c36c924b6590b88c377d416494288c14f2db30199"
+checksum = "9afd55a67069d6e434a95161415f5beeada95a01c7b815508a82dcb0e1593682"
dependencies = [
"rstest_macros",
"rustc_version",
@@ -621,9 +612,9 @@ dependencies = [
[[package]]
name = "rstest_macros"
-version = "0.18.2"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d428f8247852f894ee1be110b375111b586d4fa431f6c46e64ba5a0dcccbe605"
+checksum = "4165dfae59a39dd41d8dec720d3cbfbc71f69744efb480a3920f5d4e0cc6798d"
dependencies = [
"cfg-if",
"glob",
@@ -632,20 +623,19 @@ dependencies = [
"regex",
"relative-path",
"rustc_version",
- "syn 2.0.50",
+ "syn",
"unicode-ident",
]
[[package]]
name = "rstest_reuse"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88530b681abe67924d42cca181d070e3ac20e0740569441a9e35a7cedd2b34a4"
+checksum = "b3a8fb4672e840a587a66fc577a5491375df51ddb88f2a2c2a792598c326fe14"
dependencies = [
"quote",
"rand",
- "rustc_version",
- "syn 2.0.50",
+ "syn",
]
[[package]]
@@ -659,11 +649,11 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.38.31"
+version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
+checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
- "bitflags 2.4.2",
+ "bitflags",
"errno",
"libc",
"linux-raw-sys",
@@ -672,28 +662,28 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.22"
+version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
+checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
-version = "1.0.197"
+version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
+checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.197"
+version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
+checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.50",
+ "syn",
]
[[package]]
@@ -704,26 +694,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
-version = "0.11.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
-version = "1.0.109"
+version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "syn"
-version = "2.0.50"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
+checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
@@ -732,9 +711,9 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.10.0"
+version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
+checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
@@ -750,22 +729,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
[[package]]
name = "thiserror"
-version = "1.0.57"
+version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
+checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.57"
+version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
+checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.50",
+ "syn",
]
[[package]]
@@ -785,9 +764,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "utf8parse"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "version_check"
@@ -812,15 +791,14 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "which"
-version = "6.0.0"
+version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fa5e0c10bf77f44aac573e498d1a82d5fbd5e91f6fc0a99e7be4b38e85e101c"
+checksum = "8211e4f58a2b2805adfbefbc07bab82958fc91e3836339b1ab7ae32465dce0d7"
dependencies = [
"either",
"home",
- "once_cell",
"rustix",
- "windows-sys 0.52.0",
+ "winsafe",
]
[[package]]
@@ -838,7 +816,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets 0.52.0",
+ "windows-targets 0.52.5",
]
[[package]]
@@ -858,17 +836,18 @@ dependencies = [
[[package]]
name = "windows-targets"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
- "windows_aarch64_gnullvm 0.52.0",
- "windows_aarch64_msvc 0.52.0",
- "windows_i686_gnu 0.52.0",
- "windows_i686_msvc 0.52.0",
- "windows_x86_64_gnu 0.52.0",
- "windows_x86_64_gnullvm 0.52.0",
- "windows_x86_64_msvc 0.52.0",
+ "windows_aarch64_gnullvm 0.52.5",
+ "windows_aarch64_msvc 0.52.5",
+ "windows_i686_gnu 0.52.5",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.5",
+ "windows_x86_64_gnu 0.52.5",
+ "windows_x86_64_gnullvm 0.52.5",
+ "windows_x86_64_msvc 0.52.5",
]
[[package]]
@@ -879,9 +858,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
@@ -891,9 +870,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
@@ -903,9 +882,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
-version = "0.52.0"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
@@ -915,9 +900,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
@@ -927,9 +912,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
@@ -939,9 +924,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.52.0"
+version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
@@ -951,15 +936,21 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.52.0"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
+
+[[package]]
+name = "winsafe"
+version = "0.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
+checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
[[package]]
name = "yansi"
-version = "1.0.0-rc.1"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377"
+checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
[[package]]
name = "zoxide"
diff --git a/Cargo.toml b/Cargo.toml
index fd6ad9e8..06534cca 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,7 @@ nix = { version = "0.27.1", default-features = false, features = [
] }
[target.'cfg(windows)'.dependencies]
-which = "6.0.0"
+which = "6.0.1"
[build-dependencies]
clap = { version = "4.3.0", features = ["derive"] }
@@ -45,8 +45,8 @@ color-print = "0.3.4"
[dev-dependencies]
assert_cmd = "2.0.0"
-rstest = { version = "0.18.0", default-features = false }
-rstest_reuse = "0.6.0"
+rstest = { version = "0.21.0", default-features = false }
+rstest_reuse = "0.7.0"
tempfile = "3.1.0"
[features]
diff --git a/README.md b/README.md
index 71dde2d7..378739f9 100644
--- a/README.md
+++ b/README.md
@@ -139,9 +139,6 @@ zoxide can be installed in 4 easy steps:
Windows
- > zoxide works with PowerShell, as well as shells running in Cygwin, Git
- > Bash, and MSYS2.
- >
> The recommended way to install zoxide is via `winget`:
>
> ```sh
@@ -217,6 +214,17 @@ zoxide can be installed in 4 easy steps:
+
+ cmd.exe
+
+ > Add this to the **end** of your config file or AutoRun command:
+ >
+ > ```batchfile
+ > zoxide init cmd | cmd /d/q/k echo off
+ > ```
+
+
+
Elvish
@@ -390,7 +398,7 @@ When calling `zoxide init`, the following flags are available:
- `--cmd`
- Changes the prefix of the `z` and `zi` commands.
- `--cmd j` would change the commands to (`j`, `ji`).
- - `--cmd cd` would replace the `cd` command.
+ - `--cmd cd` would replace the `cd` command (highly recommended on `cmd.exe`).
- `--hook `
- Changes how often zoxide increments a directory's score:
| Hook | Description |
@@ -400,8 +408,8 @@ When calling `zoxide init`, the following flags are available:
| `pwd` | Whenever the directory is changed |
- `--no-cmd`
- Prevents zoxide from defining the `z` and `zi` commands.
- - These functions will still be available in your shell as `__zoxide_z` and
- `__zoxide_zi`, should you choose to redefine them.
+ - These functions will still be available in your shell (not on `cmd.exe`)
+ as `__zoxide_z` and `__zoxide_zi`, should you choose to redefine them.
### Environment variables
@@ -417,16 +425,15 @@ Environment variables[^2] can be used for configuration. They must be set before
| macOS | `$HOME/Library/Application Support` | `/Users/Alice/Library/Application Support` |
| Windows | `%LOCALAPPDATA%` | `C:\Users\Alice\AppData\Local` |
- `_ZO_ECHO`
- - When set to 1, `z` will print the matched directory before navigating to
- it.
+ - When set to 1, `z` will print the matched directory after navigating to it.
- `_ZO_EXCLUDE_DIRS`
- Excludes the specified directories from the database.
- This is provided as a list of [globs][glob], separated by OS-specific
characters:
- | OS | Separator | Example |
- | ------------------- | --------- | ----------------------- |
- | Linux / macOS / BSD | `:` | `$HOME:$HOME/private/*` |
- | Windows | `;` | `$HOME;$HOME/private/*` |
+ | OS | Separator | Example |
+ | ------------------- | --------- | ------------------------- |
+ | Linux / macOS / BSD | `:` | `$HOME:$HOME/private/*` |
+ | Windows | `;` | `%HOME%;%HOME%/private/*` |
- By default, this is set to `"$HOME"`.
- `_ZO_FZF_OPTS`
- Custom options to pass to [fzf] during interactive selection. See
diff --git a/contrib/completions/_zoxide b/contrib/completions/_zoxide
index fd898e6a..838db8b4 100644
--- a/contrib/completions/_zoxide
+++ b/contrib/completions/_zoxide
@@ -14,7 +14,7 @@ _zoxide() {
fi
local context curcontext="$curcontext" state line
- _arguments "${_arguments_options[@]}" \
+ _arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -29,7 +29,7 @@ _zoxide() {
curcontext="${curcontext%:*:*}:zoxide-command-$line[1]:"
case $line[1] in
(add)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -38,7 +38,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(edit)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -54,7 +54,7 @@ _arguments "${_arguments_options[@]}" \
curcontext="${curcontext%:*:*}:zoxide-edit-command-$line[1]:"
case $line[1] in
(decrement)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -63,7 +63,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(delete)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -72,7 +72,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(increment)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -81,7 +81,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(reload)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -93,7 +93,7 @@ _arguments "${_arguments_options[@]}" \
esac
;;
(import)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'--from=[Application to import from]:FROM:(autojump z)' \
'--merge[Merge into existing database]' \
'-h[Print help]' \
@@ -104,7 +104,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'--cmd=[Changes the prefix of the \`z\` and \`zi\` commands]:CMD: ' \
'--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]' \
@@ -112,11 +112,11 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
-':shell:(bash elvish fish nushell posix powershell xonsh zsh)' \
+':shell:(bash cmd elvish fish nushell posix powershell xonsh zsh)' \
&& ret=0
;;
(query)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'--exclude=[Exclude the current directory]:path:_files -/' \
'-a[Show unavailable directories]' \
'--all[Show unavailable directories]' \
@@ -134,7 +134,7 @@ _arguments "${_arguments_options[@]}" \
&& ret=0
;;
(remove)
-_arguments "${_arguments_options[@]}" \
+_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -164,16 +164,6 @@ _zoxide__add_commands() {
local commands; commands=()
_describe -t commands 'zoxide add commands' commands "$@"
}
-(( $+functions[_zoxide__edit__decrement_commands] )) ||
-_zoxide__edit__decrement_commands() {
- local commands; commands=()
- _describe -t commands 'zoxide edit decrement commands' commands "$@"
-}
-(( $+functions[_zoxide__edit__delete_commands] )) ||
-_zoxide__edit__delete_commands() {
- local commands; commands=()
- _describe -t commands 'zoxide edit delete commands' commands "$@"
-}
(( $+functions[_zoxide__edit_commands] )) ||
_zoxide__edit_commands() {
local commands; commands=(
@@ -184,16 +174,31 @@ _zoxide__edit_commands() {
)
_describe -t commands 'zoxide edit commands' commands "$@"
}
-(( $+functions[_zoxide__import_commands] )) ||
-_zoxide__import_commands() {
+(( $+functions[_zoxide__edit__decrement_commands] )) ||
+_zoxide__edit__decrement_commands() {
local commands; commands=()
- _describe -t commands 'zoxide import commands' commands "$@"
+ _describe -t commands 'zoxide edit decrement commands' commands "$@"
+}
+(( $+functions[_zoxide__edit__delete_commands] )) ||
+_zoxide__edit__delete_commands() {
+ local commands; commands=()
+ _describe -t commands 'zoxide edit delete commands' commands "$@"
}
(( $+functions[_zoxide__edit__increment_commands] )) ||
_zoxide__edit__increment_commands() {
local commands; commands=()
_describe -t commands 'zoxide edit increment commands' commands "$@"
}
+(( $+functions[_zoxide__edit__reload_commands] )) ||
+_zoxide__edit__reload_commands() {
+ local commands; commands=()
+ _describe -t commands 'zoxide edit reload commands' commands "$@"
+}
+(( $+functions[_zoxide__import_commands] )) ||
+_zoxide__import_commands() {
+ local commands; commands=()
+ _describe -t commands 'zoxide import commands' commands "$@"
+}
(( $+functions[_zoxide__init_commands] )) ||
_zoxide__init_commands() {
local commands; commands=()
@@ -204,11 +209,6 @@ _zoxide__query_commands() {
local commands; commands=()
_describe -t commands 'zoxide query commands' commands "$@"
}
-(( $+functions[_zoxide__edit__reload_commands] )) ||
-_zoxide__edit__reload_commands() {
- local commands; commands=()
- _describe -t commands 'zoxide edit reload commands' commands "$@"
-}
(( $+functions[_zoxide__remove_commands] )) ||
_zoxide__remove_commands() {
local commands; commands=()
diff --git a/contrib/completions/zoxide.bash b/contrib/completions/zoxide.bash
index 73dbd45f..96f72385 100644
--- a/contrib/completions/zoxide.bash
+++ b/contrib/completions/zoxide.bash
@@ -165,7 +165,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 cmd elvish fish nushell posix powershell xonsh zsh"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
diff --git a/contrib/completions/zoxide.ts b/contrib/completions/zoxide.ts
index 0200591b..3e92e318 100644
--- a/contrib/completions/zoxide.ts
+++ b/contrib/completions/zoxide.ts
@@ -180,6 +180,7 @@ const completion: Fig.Spec = {
name: "shell",
suggestions: [
"bash",
+ "cmd",
"elvish",
"fish",
"nushell",
diff --git a/man/man1/zoxide-init.1 b/man/man1/zoxide-init.1
index 387c3182..75320ea9 100644
--- a/man/man1/zoxide-init.1
+++ b/man/man1/zoxide-init.1
@@ -13,6 +13,13 @@ Add this to the \fBend\fR of your config file (usually \fB~/.bashrc\fR):
\fBeval "$(zoxide init bash)"\fR
.fi
.TP
+.B cmd.exe
+Add this to the \fBend\fR of your config file or AutoRun command:
+.sp
+.nf
+ \fBzoxide init cmd | cmd /d/q/k echo off\fR
+.fi
+.TP
.B elvish
Add this to the \fBend\fR of your config file (usually \fB~/.elvish/rc.elv\fR):
.sp
@@ -83,8 +90,8 @@ Changes the prefix of the \fBz\fR and \fBzi\fR commands.
.br
\fB--cmd j\fR would change the commands to (\fBj\fR, \fBji\fR).
.br
-\fB--cmd cd\fR would replace the \fBcd\fR command (doesn't work on Nushell /
-POSIX shells).
+\fB--cmd cd\fR would replace the \fBcd\fR command (highly recommended on
+\fBcmd.exe\fR).
.TP
.B -h, --help
Print help information.
@@ -101,8 +108,8 @@ l l.
.TP
.B --no-cmd
Prevents zoxide from defining the \fBz\fR and \fBzi\fR commands. These functions
-will still be available in your shell as \fB__zoxide_z\fR and \fB__zoxide_zi\fR,
-should you choose to redefine them.
+will still be available in your shell (not on \fBcmd.exe\fR) as \fB__zoxide_z\fR
+and \fB__zoxide_zi\fR, should you choose to redefine them.
.SH REPORTING BUGS
For any issues, feature requests, or questions, please visit:
.sp
diff --git a/man/man1/zoxide.1 b/man/man1/zoxide.1
index ef1792b6..5ee7c0c5 100644
--- a/man/man1/zoxide.1
+++ b/man/man1/zoxide.1
@@ -70,7 +70,7 @@ T}
.TE
.TP
.B _ZO_ECHO
-When set to 1, \fBz\fR will print the matched directory before navigating to it.
+When set to 1, \fBz\fR will print the matched directory after navigating to it.
.TP
.B _ZO_EXCLUDE_DIRS
Prevents the specified directories from being added to the database. This is
@@ -82,7 +82,7 @@ l l.
\fBLinux/macOS/BSD\fR|T{
\fB:\fR, eg. \fB$HOME:$HOME/private/*\fR
T}
- \fBWindows\fR|\fB;\fR, eg. \fB$HOME;$HOME/private/*\fR
+ \fBWindows\fR|\fB;\fR, eg. \fB%HOME%;%HOME%/private/*\fR
.TE
.sp
By default, this is set to \fB$HOME\fR. After setting this up, you might need
diff --git a/rustfmt.toml b/rustfmt.toml
index 024f400b..92a34686 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,6 +1,6 @@
group_imports = "StdExternalCrate"
imports_granularity = "Module"
-newline_style = "Native"
+newline_style = "Unix"
use_field_init_shorthand = true
use_small_heuristics = "Max"
use_try_shorthand = true
diff --git a/src/cmd/cmd.rs b/src/cmd/cmd.rs
index 0e5f6c42..7b4d3976 100644
--- a/src/cmd/cmd.rs
+++ b/src/cmd/cmd.rs
@@ -135,6 +135,7 @@ pub enum InitHook {
#[derive(ValueEnum, Clone, Debug)]
pub enum InitShell {
Bash,
+ Cmd,
Elvish,
Fish,
Nushell,
diff --git a/src/cmd/init.rs b/src/cmd/init.rs
index 60bad636..f5c669b5 100644
--- a/src/cmd/init.rs
+++ b/src/cmd/init.rs
@@ -6,7 +6,7 @@ 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, Cmd, Elvish, Fish, Nushell, Opts, Posix, Powershell, Xonsh, Zsh};
impl Run for Init {
fn run(&self) -> Result<()> {
@@ -17,6 +17,7 @@ impl Run for Init {
let source = match self.shell {
InitShell::Bash => Bash(opts).render(),
+ InitShell::Cmd => Cmd(opts).render(),
InitShell::Elvish => Elvish(opts).render(),
InitShell::Fish => Fish(opts).render(),
InitShell::Nushell => Nushell(opts).render(),
diff --git a/src/main.rs b/src/main.rs
index 18ac3a6d..982b1804 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,9 +1,3 @@
-#![allow(clippy::single_component_path_imports)]
-
-// rstest_reuse must be imported at the top of the crate.
-#[cfg(all(test, feature = "nix-dev"))]
-use rstest_reuse;
-
mod cmd;
mod config;
mod db;
diff --git a/src/shell.rs b/src/shell.rs
index a50c184b..c400988f 100644
--- a/src/shell.rs
+++ b/src/shell.rs
@@ -11,7 +11,7 @@ pub struct Opts<'a> {
macro_rules! make_template {
($name:ident, $path:expr) => {
#[derive(::std::fmt::Debug, ::askama::Template)]
- #[template(path = $path)]
+ #[template(path = $path, escape = "none")]
pub struct $name<'a>(pub &'a self::Opts<'a>);
impl<'a> ::std::ops::Deref for $name<'a> {
@@ -24,6 +24,7 @@ macro_rules! make_template {
}
make_template!(Bash, "bash.txt");
+make_template!(Cmd, "cmd.txt");
make_template!(Elvish, "elvish.txt");
make_template!(Fish, "fish.txt");
make_template!(Nushell, "nushell.txt");
@@ -53,6 +54,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn bash_bash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Bash(&opts).render().unwrap();
@@ -65,6 +67,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn bash_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Bash(&opts).render().unwrap();
@@ -79,6 +82,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn bash_shfmt(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Bash(&opts).render().unwrap();
@@ -94,6 +98,45 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(windows)]
+ fn cmd_cmd(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
+ let opts = Opts { cmd, hook, echo, resolve_symlinks };
+ let source = Cmd(&opts).render().unwrap();
+
+ let assert = Command::new(which::which("cmd.exe").unwrap())
+ .args(["/x", "/d", "/q", "/k", "echo off"])
+ .env("PROMPT", "")
+ .write_stdin(source)
+ .assert()
+ .success()
+ .stderr("");
+
+ if opts.hook == InitHook::None {
+ assert.stdout("");
+ }
+ }
+
+ #[apply(opts)]
+ #[cfg(windows)]
+ fn cmd_dos(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
+ let opts = Opts { cmd, hook, echo, resolve_symlinks };
+ let source = Cmd(&opts).render().unwrap();
+
+ let assert = Command::new(which::which("cmd.exe").unwrap())
+ .args(["/y", "/d", "/q", "/k", "echo off"])
+ .env("PROMPT", "")
+ .write_stdin(source)
+ .assert()
+ .success()
+ .stderr("");
+
+ if opts.hook == InitHook::None {
+ assert.stdout("");
+ }
+ }
+
+ #[apply(opts)]
+ #[cfg(unix)]
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();
@@ -114,6 +157,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn fish_fish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Fish(&opts).render().unwrap();
@@ -131,6 +175,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn fish_fishindent(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Fish(&opts).render().unwrap();
@@ -149,6 +194,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn nushell_nushell(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Nushell(&opts).render().unwrap();
@@ -169,6 +215,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn posix_bash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();
@@ -184,6 +231,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn posix_dash(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();
@@ -196,7 +244,8 @@ mod tests {
}
#[apply(opts)]
- fn posix_shellcheck_(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
+ #[cfg(unix)]
+ fn posix_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Posix(&opts).render().unwrap();
@@ -210,6 +259,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn posix_shfmt(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Posix(&opts).render().unwrap();
@@ -225,6 +275,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn powershell_pwsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = "Set-StrictMode -Version latest\n".to_string();
@@ -239,6 +290,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Xonsh(&opts).render().unwrap();
@@ -253,6 +305,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn xonsh_mypy(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Xonsh(&opts).render().unwrap();
@@ -261,6 +314,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn xonsh_pylint(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let mut source = Xonsh(&opts).render().unwrap();
@@ -275,6 +329,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn xonsh_xonsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Xonsh(&opts).render().unwrap();
@@ -292,6 +347,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn zsh_shellcheck(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Zsh(&opts).render().unwrap();
@@ -307,6 +363,7 @@ mod tests {
}
#[apply(opts)]
+ #[cfg(unix)]
fn zsh_zsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Zsh(&opts).render().unwrap();
diff --git a/src/util.rs b/src/util.rs
index 1f8fc95f..2ef9b543 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -31,7 +31,7 @@ impl Fzf {
// Instead, we resolve the path to the executable and then pass it to
// CreateProcess.
#[cfg(windows)]
- let program = which::which("fzf.exe").map_err(|_| anyhow!(Self::ERR_FZF_NOT_FOUND))?;
+ let program = which::which("fzf").map_err(|_| anyhow!(Self::ERR_FZF_NOT_FOUND))?;
#[cfg(not(windows))]
let program = "fzf";
diff --git a/templates/cmd.txt b/templates/cmd.txt
new file mode 100644
index 00000000..d3e334b8
--- /dev/null
+++ b/templates/cmd.txt
@@ -0,0 +1,68 @@
+{%- let section = "::: ===========================================================================\n:::" -%}
+{%- let not_configured = "::: -- not configured --" -%}
+
+@if "%=^%=" == "%=%=" (set \p=%%^&2 (echo(%program%: OLDPWD not set) ^& %builtin_false%) else for /f "delims=" %\p%~ in (^^"%\p%~i^") do @for /f "tokens=1,* delims=d" %\p%a in ("-%\p%~a~") do @if "%\p%b" neq "" (for /f "delims=" %\p%c in (^^""%\p%~f~"^") do @%__zoxide_cd%) else if /i "%\p%CD%\p%" neq "%\p%__CD__%\p%" (for /f "delims=" %\p%q in ('^^"%program% query --exclude "%\p%CD%\p%" -- %\p%~i^"') do @(for /f "delims=" %\p%c in (^^""%\p%~fq"^") do @%__zoxide_cd%)) else (for /f "delims=" %\p%q in ('^^"%program% query --exclude "%\p%__CD__%\p%\" -- %\p%~i^"') do @(for /f "delims=" %\p%c in (^^""%\p%~fq"^") do @%__zoxide_cd%))) ^&^& %builtin_true%
+
+::: Jump to a directory using interactive search.
+%sysdir%doskey.exe {{ cmd }}i = @(for %\p%^^^^ in ("") do @for /f "delims=" %\p%i in (^^""$*%\p%~^^"^") do @for /f "delims=" %\p%p in ('^^"%program% query --interactive -- %\p%~i^"') do @for /f "delims=" %\p%c in (^^""%\p%~fp"^") do @%__zoxide_cd%) ^&^& %builtin_true%
+
+{%- when None %}
+
+{{ not_configured }}
+
+{%- endmatch %}
+
+{{ section }}
+::: To initialize zoxide, add this to your configuration or AutoRun command:
+:::
+::: zoxide init cmd | cmd /d/q/k echo off
+
+{#~
+ Content piped to `cmd.exe` needs to end with an empty line to indicate end of
+ input. Removing this will cause extra "More? " to be written to stdout.
+#}
diff --git a/templates/posix.txt b/templates/posix.txt
index ca4b53f0..1c039cd7 100644
--- a/templates/posix.txt
+++ b/templates/posix.txt
@@ -60,8 +60,7 @@ __zoxide_z() {
if [ -n "${OLDPWD}" ]; then
__zoxide_cd "${OLDPWD}"
else
- # shellcheck disable=SC2016
- \command printf 'zoxide: $OLDPWD is not set'
+ \command printf 'zoxide: OLDPWD not set'
return 1
fi
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
diff --git a/zoxide.plugin.zsh b/zoxide.plugin.zsh
index aa89a445..cba04b28 100644
--- a/zoxide.plugin.zsh
+++ b/zoxide.plugin.zsh
@@ -1,5 +1,5 @@
if (( $+commands[zoxide] )); then
- eval "$(zoxide init zsh)"
+ eval "$(zoxide init zsh)"
else
- echo 'zoxide: command not found, please install it from https://github.com/ajeetdsouza/zoxide'
+ echo 'zoxide: command not found, please install it from https://github.com/ajeetdsouza/zoxide'
fi