diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 0588323192..1c3b81ba76 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -130,6 +130,6 @@ quickcheck_macros = "0.9.1" [features] clipboard-cli = ["arboard"] rich-benchmark = ["heim"] -rustyline-support = ["rustyline"] +rustyline-support = ["rustyline", "nu-engine/rustyline-support"] stable = [] trash-support = ["trash"] diff --git a/crates/nu-cli/src/keybinding.rs b/crates/nu-cli/src/keybinding.rs index f6b9f3f6f9..201fcd8024 100644 --- a/crates/nu-cli/src/keybinding.rs +++ b/crates/nu-cli/src/keybinding.rs @@ -405,14 +405,10 @@ pub struct Keybinding { type Keybindings = Vec; -pub(crate) fn keybinding_path() -> Result { - nu_data::config::default_path_for(&Some(std::path::PathBuf::from("keybindings.yml"))) -} - pub(crate) fn load_keybindings( rl: &mut rustyline::Editor, ) -> Result<(), nu_errors::ShellError> { - let filename = keybinding_path()?; + let filename = nu_data::keybinding::keybinding_path()?; let contents = std::fs::read_to_string(filename); // Silently fail if there is no file there diff --git a/crates/nu-data/src/keybinding.rs b/crates/nu-data/src/keybinding.rs new file mode 100644 index 0000000000..9c36d463cd --- /dev/null +++ b/crates/nu-data/src/keybinding.rs @@ -0,0 +1,3 @@ +pub fn keybinding_path() -> Result { + crate::config::default_path_for(&Some(std::path::PathBuf::from("keybindings.yml"))) +} diff --git a/crates/nu-data/src/lib.rs b/crates/nu-data/src/lib.rs index 809d499a61..1705e25379 100644 --- a/crates/nu-data/src/lib.rs +++ b/crates/nu-data/src/lib.rs @@ -2,6 +2,7 @@ pub mod base; pub mod command; pub mod config; pub mod dict; +pub mod keybinding; pub mod primitive; pub mod types; pub mod utils; diff --git a/crates/nu-engine/Cargo.toml b/crates/nu-engine/Cargo.toml index 172f4ba707..579c0ad1ca 100644 --- a/crates/nu-engine/Cargo.toml +++ b/crates/nu-engine/Cargo.toml @@ -48,3 +48,6 @@ users = "0.10.0" [dev-dependencies] nu-test-support = {version = "0.25.2", path = "../nu-test-support"} + +[features] +rustyline-support = [] diff --git a/crates/nu-engine/src/evaluate/variables.rs b/crates/nu-engine/src/evaluate/variables.rs index 34f79e7887..e9f0a1170b 100644 --- a/crates/nu-engine/src/evaluate/variables.rs +++ b/crates/nu-engine/src/evaluate/variables.rs @@ -47,7 +47,7 @@ pub fn nu(env: &IndexMap, tag: impl Into) -> Result