Add search terms in random and expression categories (#7736)

# Description

Refers to: [5093](https://github.com/nushell/nushell/issues/5093)

# Tests

- [x] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
- [x] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- [x]  `cargo test --workspace` to check that all tests pass
This commit is contained in:
Nupur Agrawal 2023-01-12 18:31:40 +05:30 committed by GitHub
parent 48b7b415e2
commit b004aacd69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 64 additions and 0 deletions

View File

@ -59,6 +59,10 @@ impl Command for ExprAlias {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["aka", "abbr", "otherwise"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -43,6 +43,10 @@ impl Command for ExprArgWhere {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["condition", "match", "if"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -37,6 +37,10 @@ impl Command for ExprAsNu {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["convert", "conversion"]
}
fn run( fn run(
&self, &self,
_engine_state: &EngineState, _engine_state: &EngineState,

View File

@ -43,6 +43,10 @@ impl Command for ExprCol {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["create"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -69,6 +69,10 @@ impl Command for ExprConcatStr {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["join", "connect", "update"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -65,6 +65,10 @@ impl Command for ExprIsIn {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["check", "contained", "is-contain", "match"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -42,6 +42,10 @@ impl Command for ExprLit {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["string", "literal", "expression"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -79,6 +79,10 @@ impl Command for ExprOtherwise {
] ]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["condition", "else"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -55,6 +55,10 @@ impl Command for ExprQuantile {
}] }]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["statistics", "percentile", "distribution"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -85,6 +85,10 @@ impl Command for ExprWhen {
] ]
} }
fn search_terms(&self) -> Vec<&str> {
vec!["condition", "match", "if", "else"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -31,6 +31,10 @@ impl Command for SubCommand {
"Generate a random boolean value" "Generate a random boolean value"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "boolean", "true", "false", "1", "0"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -31,6 +31,10 @@ impl Command for SubCommand {
"Generate random chars" "Generate random chars"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "character", "symbol", "alphanumeric"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for SubCommand {
"Generate a random decimal within a range [min..max]" "Generate a random decimal within a range [min..max]"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "float"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -37,6 +37,10 @@ impl Command for SubCommand {
"Generate a random dice roll" "Generate a random dice roll"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "die", "1-6"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -27,6 +27,10 @@ impl Command for SubCommand {
"Generate a random integer [min..max]" "Generate a random integer [min..max]"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "natural", "number"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View File

@ -22,6 +22,10 @@ impl Command for SubCommand {
"Generate a random uuid4 string" "Generate a random uuid4 string"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["generate", "uuid4"]
}
fn run( fn run(
&self, &self,
_engine_state: &EngineState, _engine_state: &EngineState,