From f78d57a7039d03296ac9deaebf93e47df4d9f6ce Mon Sep 17 00:00:00 2001 From: Marshall Bruner <43101405+brunerm99@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:11:42 +0200 Subject: [PATCH] feat: Search terms for use, while, and range (#5093) (#10265) # Description Add search terms to the commands: `use` ("environment", "import"), `while` ("loop"), and `range` ("filter", "head", "tail"). # Tests + Formatting All completed successfully. --------- Co-authored-by: Stefan Holderbach --- crates/nu-cmd-lang/src/core_commands/use_.rs | 4 ++++ crates/nu-cmd-lang/src/core_commands/while_.rs | 4 ++++ crates/nu-command/src/filters/range.rs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/crates/nu-cmd-lang/src/core_commands/use_.rs b/crates/nu-cmd-lang/src/core_commands/use_.rs index cf8860ec98..fd42b9ee4e 100644 --- a/crates/nu-cmd-lang/src/core_commands/use_.rs +++ b/crates/nu-cmd-lang/src/core_commands/use_.rs @@ -30,6 +30,10 @@ impl Command for Use { .category(Category::Core) } + fn search_terms(&self) -> Vec<&str> { + vec!["module", "import", "include", "scope"] + } + fn extra_usage(&self) -> &str { r#"See `help std` for the standard library module. See `help modules` to list all available modules. diff --git a/crates/nu-cmd-lang/src/core_commands/while_.rs b/crates/nu-cmd-lang/src/core_commands/while_.rs index 4a6f842ff2..27cc401e41 100644 --- a/crates/nu-cmd-lang/src/core_commands/while_.rs +++ b/crates/nu-cmd-lang/src/core_commands/while_.rs @@ -30,6 +30,10 @@ impl Command for While { .category(Category::Core) } + fn search_terms(&self) -> Vec<&str> { + vec!["loop"] + } + fn run( &self, engine_state: &EngineState, diff --git a/crates/nu-command/src/filters/range.rs b/crates/nu-command/src/filters/range.rs index 1fc20e9dda..7c529ee4df 100644 --- a/crates/nu-command/src/filters/range.rs +++ b/crates/nu-command/src/filters/range.rs @@ -33,6 +33,10 @@ impl Command for Range { "Return only the selected rows." } + fn search_terms(&self) -> Vec<&str> { + vec!["filter", "head", "tail"] + } + fn examples(&self) -> Vec { vec![ Example {