feat: add search terms to category of strings (#5723)

This commit is contained in:
Jae-Heon Ji 2022-06-06 22:47:09 +09:00 committed by GitHub
parent b8d253cbd7
commit 820a6bfb08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 112 additions and 0 deletions

View File

@ -19,6 +19,10 @@ impl Command for NuHighlight {
"Syntax highlight the input string."
}
fn search_terms(&self) -> Vec<&str> {
vec!["syntax", "color", "convert"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -28,6 +28,10 @@ impl Command for Print {
"Prints the values given"
}
fn search_terms(&self) -> Vec<&str> {
vec!["display"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -19,6 +19,10 @@ impl Command for Decode {
"Decode bytes as a string."
}
fn search_terms(&self) -> Vec<&str> {
vec!["text", "encoding", "decoding"]
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("decode")
.required("encoding", SyntaxShape::String, "the text encoding to use")

View File

@ -35,6 +35,10 @@ impl Command for DetectColumns {
"Attempt to automatically split text into multiple columns"
}
fn search_terms(&self) -> Vec<&str> {
vec!["split"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -34,6 +34,10 @@ impl Command for FileSize {
"Converts a column of filesizes to some specified format"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "display", "pattern", "file", "size"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -19,6 +19,10 @@ impl Command for Parse {
"Parse columns from string data using a simple pattern."
}
fn search_terms(&self) -> Vec<&str> {
vec!["pattern", "match"]
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("parse")
.required(

View File

@ -24,6 +24,10 @@ impl Command for Size {
"Gather word count statistics on the text."
}
fn search_terms(&self) -> Vec<&str> {
vec!["count", "word", "character", "unicode"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -20,6 +20,10 @@ impl Command for SubCommand {
"Split a string's characters into separate rows"
}
fn search_terms(&self) -> Vec<&str> {
vec!["character", "separate", "divide"]
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Split the string's characters into separate rows",

View File

@ -33,6 +33,10 @@ impl Command for SubCommand {
"Split a string into multiple columns using a separator"
}
fn search_terms(&self) -> Vec<&str> {
vec!["column", "separate", "divide"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -33,6 +33,10 @@ impl Command for SubCommand {
"Split a string into multiple rows using a separator"
}
fn search_terms(&self) -> Vec<&str> {
vec!["row", "separate", "divide"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -29,6 +29,10 @@ impl Command for SubCommand {
"Convert a string to camelCase"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "caps", "convention"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for SubCommand {
"Capitalize first letter of text"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "caps", "upper"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -29,6 +29,10 @@ impl Command for SubCommand {
"Convert a string to kebab-case"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "hyphens", "convention"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -29,6 +29,10 @@ impl Command for SubCommand {
"Convert a string to PascalCase"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "caps", "upper", "convention"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -28,6 +28,10 @@ impl Command for SubCommand {
"Convert a string to SCREAMING_SNAKE_CASE"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "snake", "underscore", "convention"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -23,10 +23,22 @@ impl Command for SubCommand {
)
.category(Category::Strings)
}
fn usage(&self) -> &str {
"Convert a string to snake_case"
}
fn search_terms(&self) -> Vec<&str> {
vec![
"convert",
"style",
"snake",
"underscore",
"lower",
"convention",
]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -29,6 +29,10 @@ impl Command for SubCommand {
"Convert a string to Title Case"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "style", "title", "convention"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -32,6 +32,10 @@ impl Command for SubCommand {
"Checks if string contains pattern"
}
fn search_terms(&self) -> Vec<&str> {
vec!["pattern", "match", "find", "search"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -29,6 +29,10 @@ impl Command for SubCommand {
"Check if a string ends with a pattern"
}
fn search_terms(&self) -> Vec<&str> {
vec!["pattern", "match", "find", "search"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -51,6 +51,10 @@ impl Command for SubCommand {
"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(
&self,
engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for SubCommand {
"Output the length of any strings in the pipeline"
}
fn search_terms(&self) -> Vec<&str> {
vec!["len", "size", "count"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -41,6 +41,10 @@ impl Command for SubCommand {
"Left-pad a string to a specific length"
}
fn search_terms(&self) -> Vec<&str> {
vec!["append", "truncate", "padding"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -51,6 +51,10 @@ impl Command for SubCommand {
"Find and replace text"
}
fn search_terms(&self) -> Vec<&str> {
vec!["search", "shift", "switch"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for SubCommand {
"Reverse every string in the pipeline"
}
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "inverse"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -41,6 +41,10 @@ impl Command for SubCommand {
"Right-pad a string to a specific length"
}
fn search_terms(&self) -> Vec<&str> {
vec!["append", "truncate", "padding"]
}
fn run(
&self,
engine_state: &EngineState,

View File

@ -36,6 +36,10 @@ impl Command for SubCommand {
"Check if string starts with a pattern"
}
fn search_terms(&self) -> Vec<&str> {
vec!["pattern", "match", "find", "search"]
}
fn run(
&self,
engine_state: &EngineState,