mirror of
https://github.com/nushell/nushell
synced 2025-01-15 06:34:15 +00:00
Add search terms to many commands (#5096)
This commit is contained in:
parent
fa6ed7a40b
commit
657b631fdc
17 changed files with 62 additions and 2 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue