Add search terms to many commands (#5096)

This commit is contained in:
Reilly Wood 2022-04-05 05:01:21 -07:00 committed by GitHub
parent fa6ed7a40b
commit 657b631fdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 62 additions and 2 deletions

View file

@ -35,6 +35,10 @@ impl Command for Tutor {
"Run the tutorial. To begin, run: tutor" "Run the tutorial. To begin, run: tutor"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["help", "learn", "tutorial"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -27,6 +27,10 @@ impl Command for Ls {
"List the files in a directory." "List the files in a directory."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["dir"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("ls") Signature::build("ls")
// Using a string instead of a glob pattern shape so it won't auto-expand // Using a string instead of a glob pattern shape so it won't auto-expand

View file

@ -25,7 +25,7 @@ impl Command for Append {
} }
fn search_terms(&self) -> Vec<&str> { fn search_terms(&self) -> Vec<&str> {
vec!["concatenate"] vec!["add", "concatenate"]
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View file

@ -28,6 +28,10 @@ impl Command for DropColumn {
"Remove the last number of columns. If you want to remove columns by name, try 'reject'." "Remove the last number of columns. If you want to remove columns by name, try 'reject'."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["delete"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -29,6 +29,10 @@ impl Command for Drop {
"Remove the last number of rows or columns." "Remove the last number of rows or columns."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["delete"]
}
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {

View file

@ -31,6 +31,10 @@ impl Command for DropNth {
"Drop the selected rows." "Drop the selected rows."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["delete"]
}
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {

View file

@ -18,6 +18,10 @@ impl Command for Each {
"Run a block on each element of input" "Run a block on each element of input"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["for", "loop", "iterate"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("each") Signature::build("each")
.required( .required(

View file

@ -33,6 +33,10 @@ impl Command for Insert {
"Insert a new column." "Insert a new column."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["add"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -29,7 +29,7 @@ impl Command for Prepend {
} }
fn search_terms(&self) -> Vec<&str> { fn search_terms(&self) -> Vec<&str> {
vec!["concatenate"] vec!["add", "concatenate"]
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View file

@ -44,6 +44,10 @@ impl Command for Transpose {
"Transposes the table contents so rows become columns and columns become rows." "Transposes the table contents so rows become columns and columns become rows."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["pivot"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -35,6 +35,10 @@ impl Command for Uniq {
"Return the unique rows." "Return the unique rows."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["distinct", "deduplicate"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -33,6 +33,10 @@ impl Command for Upsert {
"Update an existing column to have a new value, or insert a new column." "Update an existing column to have a new value, or insert a new column."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["add"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -19,6 +19,10 @@ impl Command for Input {
"Get input from the user." "Get input from the user."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["prompt", "interactive"]
}
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("input") Signature::build("input")
.optional("prompt", SyntaxShape::String, "prompt to show the user") .optional("prompt", SyntaxShape::String, "prompt to show the user")

View file

@ -171,6 +171,10 @@ impl Command for Char {
"Output special characters (e.g., 'newline')." "Output special characters (e.g., 'newline')."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["line break", "newline", "Unicode"]
}
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {

View file

@ -27,6 +27,10 @@ impl Command for SubCommand {
"downcases text" "downcases text"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["lower case", "lowercase"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -24,6 +24,10 @@ impl Command for SubCommand {
"upcases text" "upcases text"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["uppercase", "upper case"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -32,6 +32,10 @@ impl Command for Table {
"Render the table." "Render the table."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["display", "render"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("table") Signature::build("table")
.named( .named(