From bb5ab5d16c6e26e99c3ab576ff28c836315dc040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Wed, 30 Jun 2021 19:45:27 -0500 Subject: [PATCH] nu-cli ctrl-c feature support. (#3718) Seems we do `ctrl` feature checks in `nu-cli` and `nu-command`. We should find a better way to report the enabled features un the `version` command without using the conditionals (or somewhere else) --- Cargo.lock | 1 + Cargo.toml | 2 +- crates/nu-cli/Cargo.toml | 1 + crates/nu-command/src/commands/core_commands/version.rs | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ff4432bd4c..dd18af2db3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3309,6 +3309,7 @@ dependencies = [ name = "nu-cli" version = "0.33.1" dependencies = [ + "ctrlc", "indexmap", "log 0.4.14", "nu-ansi-term", diff --git a/Cargo.toml b/Cargo.toml index b4769c08b3..31e50c3524 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ rstest = "0.10.0" [build-dependencies] [features] -ctrlc-support = ["nu-command/ctrlc"] +ctrlc-support = ["nu-cli/ctrlc", "nu-command/ctrlc"] ptree-support = ["nu-command/ptree"] rustyline-support = ["nu-cli/rustyline-support", "nu-command/rustyline-support"] term-support = ["nu-command/term"] diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index d3c9c9c160..a84479ee97 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -27,6 +27,7 @@ log = "0.4.14" pretty_env_logger = "0.4.0" strip-ansi-escapes = "0.1.0" rustyline = { version="8.1.0", optional=true } +ctrlc = { version="3.1.7", optional=true } shadow-rs = { version="0.5", default-features=false, optional=true } serde = { version="1.0.123", features=["derive"] } serde_yaml = "0.8.16" diff --git a/crates/nu-command/src/commands/core_commands/version.rs b/crates/nu-command/src/commands/core_commands/version.rs index 01cd3f880a..d4eb13a7a1 100644 --- a/crates/nu-command/src/commands/core_commands/version.rs +++ b/crates/nu-command/src/commands/core_commands/version.rs @@ -184,6 +184,8 @@ pub fn version(args: CommandArgs) -> Result { fn features_enabled() -> Vec { let mut names = vec!["default".to_string()]; + // NOTE: There should be another way to know + // features on. #[cfg(feature = "ctrlc")] { names.push("ctrlc".to_string());