diff --git a/Cargo.toml b/Cargo.toml index 4d67c35148..07cb2b53cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,9 +82,7 @@ rustyline-support = ["nu-cli/rustyline-support", "nu-command/rustyline-support"] term-support = ["nu-cli/term", "nu-command/term"] uuid-support = ["nu-cli/uuid_crate", "nu-command/uuid_crate"] which-support = [ - "nu-cli/ichwh", "nu-cli/which", - "nu-command/ichwh", "nu-command/which", "nu-engine/which", ] diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 1038636ad5..ed37b0dc38 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -57,7 +57,6 @@ getset = "0.1.1" glob = "0.3.0" htmlescape = "0.3.1" ical = "0.7.0" -ichwh = { version = "0.3.4", optional = true } indexmap = { version = "1.6.1", features = ["serde-1"] } itertools = "0.10.0" lazy_static = "1.*" diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index 351a8a919d..7a81875c5d 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -53,7 +53,6 @@ getset = "0.1.1" glob = "0.3.0" htmlescape = "0.3.1" ical = "0.7.0" -ichwh = { version = "0.3.4", optional = true } indexmap = { version = "1.6.1", features = ["serde-1"] } itertools = "0.10.0" lazy_static = "1.*" @@ -97,7 +96,7 @@ trash = { version = "1.3.0", optional = true } unicode-segmentation = "1.7.1" url = "2.2.0" uuid_crate = { package = "uuid", version = "0.8.2", features = ["v4"], optional = true } -which = { version = "4.0.2", optional = true } +which = { version = "4.1.0", optional = true } zip = { version = "0.5.9", optional = true } [target.'cfg(unix)'.dependencies] diff --git a/crates/nu-command/src/commands/version.rs b/crates/nu-command/src/commands/version.rs index 4aadc3cbc0..f7b668d044 100644 --- a/crates/nu-command/src/commands/version.rs +++ b/crates/nu-command/src/commands/version.rs @@ -192,11 +192,6 @@ fn features_enabled() -> Vec { names.push("which".to_string()); } - #[cfg(feature = "ichwh")] - { - names.push("ichwh".to_string()); - } - #[cfg(feature = "zip")] { names.push("zip".to_string()); diff --git a/crates/nu-command/src/commands/which_.rs b/crates/nu-command/src/commands/which_.rs index d13cac8c6b..ebb3c9aff9 100644 --- a/crates/nu-command/src/commands/which_.rs +++ b/crates/nu-command/src/commands/which_.rs @@ -135,32 +135,28 @@ macro_rules! entry_path { }; } -#[cfg(feature = "ichwh")] +#[cfg(feature = "which")] fn get_first_entry_in_path(item: &str, tag: Tag) -> Option { - use futures::executor::block_on; - - block_on(ichwh::which(item)) - .unwrap_or(None) - .map(|path| entry_path!(item, path.into(), tag)) + which::which(item) + .map(|path| entry_path!(item, path, tag)) + .ok() } -#[cfg(not(feature = "ichwh"))] +#[cfg(not(feature = "which"))] fn get_first_entry_in_path(_: &str, _: Tag) -> Option { None } -#[cfg(feature = "ichwh")] +#[cfg(feature = "which")] fn get_all_entries_in_path(item: &str, tag: Tag) -> Vec { - use futures::executor::block_on; - - block_on(ichwh::which_all(&item)) + which::which_all(&item) + .map(|iter| { + iter.map(|path| entry_path!(item, path, tag.clone())) + .collect() + }) .unwrap_or_default() - .into_iter() - .map(|path| entry_path!(item, path.into(), tag.clone())) - .collect() } - -#[cfg(not(feature = "ichwh"))] +#[cfg(not(feature = "which"))] fn get_all_entries_in_path(_: &str, _: Tag) -> Vec { vec![] }