mirror of
https://github.com/nushell/nushell.git
synced 2025-05-01 00:24:29 +02:00
feat: add search terms to category of strings (#5723)
This commit is contained in:
parent
b8d253cbd7
commit
820a6bfb08
@ -19,6 +19,10 @@ impl Command for NuHighlight {
|
|||||||
"Syntax highlight the input string."
|
"Syntax highlight the input string."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["syntax", "color", "convert"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -28,6 +28,10 @@ impl Command for Print {
|
|||||||
"Prints the values given"
|
"Prints the values given"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["display"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -19,6 +19,10 @@ impl Command for Decode {
|
|||||||
"Decode bytes as a string."
|
"Decode bytes as a string."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["text", "encoding", "decoding"]
|
||||||
|
}
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("decode")
|
Signature::build("decode")
|
||||||
.required("encoding", SyntaxShape::String, "the text encoding to use")
|
.required("encoding", SyntaxShape::String, "the text encoding to use")
|
||||||
|
@ -35,6 +35,10 @@ impl Command for DetectColumns {
|
|||||||
"Attempt to automatically split text into multiple columns"
|
"Attempt to automatically split text into multiple columns"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["split"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -34,6 +34,10 @@ impl Command for FileSize {
|
|||||||
"Converts a column of filesizes to some specified format"
|
"Converts a column of filesizes to some specified format"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "display", "pattern", "file", "size"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -19,6 +19,10 @@ impl Command for Parse {
|
|||||||
"Parse columns from string data using a simple pattern."
|
"Parse columns from string data using a simple pattern."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["pattern", "match"]
|
||||||
|
}
|
||||||
|
|
||||||
fn signature(&self) -> nu_protocol::Signature {
|
fn signature(&self) -> nu_protocol::Signature {
|
||||||
Signature::build("parse")
|
Signature::build("parse")
|
||||||
.required(
|
.required(
|
||||||
|
@ -24,6 +24,10 @@ impl Command for Size {
|
|||||||
"Gather word count statistics on the text."
|
"Gather word count statistics on the text."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["count", "word", "character", "unicode"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -20,6 +20,10 @@ impl Command for SubCommand {
|
|||||||
"Split a string's characters into separate rows"
|
"Split a string's characters into separate rows"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["character", "separate", "divide"]
|
||||||
|
}
|
||||||
|
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Split the string's characters into separate rows",
|
description: "Split the string's characters into separate rows",
|
||||||
|
@ -33,6 +33,10 @@ impl Command for SubCommand {
|
|||||||
"Split a string into multiple columns using a separator"
|
"Split a string into multiple columns using a separator"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["column", "separate", "divide"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -33,6 +33,10 @@ impl Command for SubCommand {
|
|||||||
"Split a string into multiple rows using a separator"
|
"Split a string into multiple rows using a separator"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["row", "separate", "divide"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -29,6 +29,10 @@ impl Command for SubCommand {
|
|||||||
"Convert a string to camelCase"
|
"Convert a string to camelCase"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "caps", "convention"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -27,6 +27,10 @@ impl Command for SubCommand {
|
|||||||
"Capitalize first letter of text"
|
"Capitalize first letter of text"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "caps", "upper"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -29,6 +29,10 @@ impl Command for SubCommand {
|
|||||||
"Convert a string to kebab-case"
|
"Convert a string to kebab-case"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "hyphens", "convention"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -29,6 +29,10 @@ impl Command for SubCommand {
|
|||||||
"Convert a string to PascalCase"
|
"Convert a string to PascalCase"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "caps", "upper", "convention"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -28,6 +28,10 @@ impl Command for SubCommand {
|
|||||||
"Convert a string to SCREAMING_SNAKE_CASE"
|
"Convert a string to SCREAMING_SNAKE_CASE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "snake", "underscore", "convention"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -23,10 +23,22 @@ impl Command for SubCommand {
|
|||||||
)
|
)
|
||||||
.category(Category::Strings)
|
.category(Category::Strings)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
"Convert a string to snake_case"
|
"Convert a string to snake_case"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec![
|
||||||
|
"convert",
|
||||||
|
"style",
|
||||||
|
"snake",
|
||||||
|
"underscore",
|
||||||
|
"lower",
|
||||||
|
"convention",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -29,6 +29,10 @@ impl Command for SubCommand {
|
|||||||
"Convert a string to Title Case"
|
"Convert a string to Title Case"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "style", "title", "convention"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -32,6 +32,10 @@ impl Command for SubCommand {
|
|||||||
"Checks if string contains pattern"
|
"Checks if string contains pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["pattern", "match", "find", "search"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -29,6 +29,10 @@ impl Command for SubCommand {
|
|||||||
"Check if a string ends with a pattern"
|
"Check if a string ends with a pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["pattern", "match", "find", "search"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -51,6 +51,10 @@ impl Command for SubCommand {
|
|||||||
"Returns start index of first occurrence of pattern in string, or -1 if no match"
|
"Returns start index of first occurrence of pattern in string, or -1 if no match"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["pattern", "match", "find", "search", "index"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -27,6 +27,10 @@ impl Command for SubCommand {
|
|||||||
"Output the length of any strings in the pipeline"
|
"Output the length of any strings in the pipeline"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["len", "size", "count"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -41,6 +41,10 @@ impl Command for SubCommand {
|
|||||||
"Left-pad a string to a specific length"
|
"Left-pad a string to a specific length"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["append", "truncate", "padding"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -51,6 +51,10 @@ impl Command for SubCommand {
|
|||||||
"Find and replace text"
|
"Find and replace text"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["search", "shift", "switch"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -27,6 +27,10 @@ impl Command for SubCommand {
|
|||||||
"Reverse every string in the pipeline"
|
"Reverse every string in the pipeline"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["convert", "inverse"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -41,6 +41,10 @@ impl Command for SubCommand {
|
|||||||
"Right-pad a string to a specific length"
|
"Right-pad a string to a specific length"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["append", "truncate", "padding"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
@ -36,6 +36,10 @@ impl Command for SubCommand {
|
|||||||
"Check if string starts with a pattern"
|
"Check if string starts with a pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
vec!["pattern", "match", "find", "search"]
|
||||||
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
|
Loading…
Reference in New Issue
Block a user