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"
}
fn search_terms(&self) -> Vec<&str> {
vec!["help", "learn", "tutorial"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for Ls {
"List the files in a directory."
}
fn search_terms(&self) -> Vec<&str> {
vec!["dir"]
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("ls")
// 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> {
vec!["concatenate"]
vec!["add", "concatenate"]
}
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'."
}
fn search_terms(&self) -> Vec<&str> {
vec!["delete"]
}
fn run(
&self,
engine_state: &EngineState,

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ impl Command for Prepend {
}
fn search_terms(&self) -> Vec<&str> {
vec!["concatenate"]
vec!["add", "concatenate"]
}
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."
}
fn search_terms(&self) -> Vec<&str> {
vec!["pivot"]
}
fn run(
&self,
engine_state: &EngineState,

View File

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

View File

@ -19,6 +19,10 @@ impl Command for Input {
"Get input from the user."
}
fn search_terms(&self) -> Vec<&str> {
vec!["prompt", "interactive"]
}
fn signature(&self) -> Signature {
Signature::build("input")
.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')."
}
fn search_terms(&self) -> Vec<&str> {
vec!["line break", "newline", "Unicode"]
}
fn examples(&self) -> Vec<Example> {
vec![
Example {

View File

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

View File

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

View File

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