mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 08:53:29 +01:00
feat: add search terms to date (#5306)
* add search terms * add search terms * add search terms * add search terms * add search terms * add search terms * add search terms * add search terms * add search patterns * run cargo fmt --all
This commit is contained in:
parent
b9eb213f36
commit
667eb27d1b
@ -21,6 +21,20 @@ impl Command for Date {
|
||||
"Date-related commands"
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec![
|
||||
"date",
|
||||
"time",
|
||||
"now",
|
||||
"today",
|
||||
"tomorrow",
|
||||
"yesterday",
|
||||
"weekday",
|
||||
"weekday_name",
|
||||
"timezone",
|
||||
]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -31,6 +31,10 @@ impl Command for SubCommand {
|
||||
"Format a given date using a format string."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["date", "format", "strftime"]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -20,6 +20,21 @@ impl Command for SubCommand {
|
||||
"Print a 'humanized' format for the date, relative to now."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec![
|
||||
"date",
|
||||
"humanize",
|
||||
"relative",
|
||||
"now",
|
||||
"today",
|
||||
"tomorrow",
|
||||
"yesterday",
|
||||
"weekday",
|
||||
"weekday_name",
|
||||
"timezone",
|
||||
]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -21,6 +21,10 @@ impl Command for SubCommand {
|
||||
"List supported time zones."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["UTC", "GMT", "timezone", "list", "list-timezone"]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -18,6 +18,10 @@ impl Command for SubCommand {
|
||||
"Get the current date."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["date", "now", "present", "current-time"]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
|
@ -22,6 +22,10 @@ impl Command for SubCommand {
|
||||
"Convert the date into a structured table."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["date", "to", "record", "structured", "table"]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -22,6 +22,10 @@ impl Command for SubCommand {
|
||||
"Convert the date into a structured table."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["date", "to", "record", "structured", "table"]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -32,6 +32,20 @@ impl Command for SubCommand {
|
||||
"Use 'date list-timezone' to list all supported time zones."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec![
|
||||
"date",
|
||||
"to",
|
||||
"timezone",
|
||||
"transform",
|
||||
"convert",
|
||||
"UTC",
|
||||
"GMT",
|
||||
"list",
|
||||
"list-timezone",
|
||||
]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -17,6 +17,10 @@ impl Command for Cd {
|
||||
"Change directory."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["cd", "change", "directory", "dir", "folder", "switch"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("cd")
|
||||
.optional("path", SyntaxShape::Directory, "the path to change to")
|
||||
|
@ -28,6 +28,10 @@ impl Command for Cp {
|
||||
"Copy files."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["cp", "copy", "file", "files"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("cp")
|
||||
.required("source", SyntaxShape::GlobPattern, "the place to copy from")
|
||||
|
@ -32,6 +32,10 @@ impl Command for Glob {
|
||||
"Creates a list of files and/or folders based on the glob pattern provided."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["glob", "files", "folders", "list", "ls"]
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
|
@ -32,6 +32,18 @@ impl Command for Mkdir {
|
||||
"Make directories, creates intermediary directories as required."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec![
|
||||
"mkdir",
|
||||
"make",
|
||||
"directory",
|
||||
"dir",
|
||||
"folder",
|
||||
"make_dir",
|
||||
"make_dirs",
|
||||
]
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
@ -29,6 +29,10 @@ impl Command for Mv {
|
||||
"Move files or directories."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["mv", "move"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("mv")
|
||||
.required(
|
||||
|
@ -25,6 +25,10 @@ impl Command for Open {
|
||||
"Load a file into a cell, converting to table if possible (avoid by appending '--raw')."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["open", "load", "read", "load_file", "read_file"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("open")
|
||||
.optional("filename", SyntaxShape::Filepath, "the filename to use")
|
||||
|
@ -38,6 +38,10 @@ impl Command for Rm {
|
||||
"Remove file(s)."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["rm", "remove"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
let sig = Signature::build("rm");
|
||||
#[cfg(all(
|
||||
|
@ -20,6 +20,10 @@ impl Command for Save {
|
||||
"Save a file."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["save", "write", "write_file"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> nu_protocol::Signature {
|
||||
Signature::build("save")
|
||||
.required("filename", SyntaxShape::Filepath, "the filename to use")
|
||||
|
@ -24,6 +24,10 @@ impl Command for Touch {
|
||||
"touch"
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec!["touch"]
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("touch")
|
||||
.required(
|
||||
|
Loading…
Reference in New Issue
Block a user