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:
Abdulqudduus Babalola 2022-04-23 14:54:03 +01:00 committed by GitHub
parent b9eb213f36
commit 667eb27d1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 107 additions and 0 deletions

View file

@ -21,6 +21,20 @@ impl Command for Date {
"Date-related commands" "Date-related commands"
} }
fn search_terms(&self) -> Vec<&str> {
vec![
"date",
"time",
"now",
"today",
"tomorrow",
"yesterday",
"weekday",
"weekday_name",
"timezone",
]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -31,6 +31,10 @@ impl Command for SubCommand {
"Format a given date using a format string." "Format a given date using a format string."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["date", "format", "strftime"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -20,6 +20,21 @@ impl Command for SubCommand {
"Print a 'humanized' format for the date, relative to now." "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( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -21,6 +21,10 @@ impl Command for SubCommand {
"List supported time zones." "List supported time zones."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["UTC", "GMT", "timezone", "list", "list-timezone"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -18,6 +18,10 @@ impl Command for SubCommand {
"Get the current date." "Get the current date."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["date", "now", "present", "current-time"]
}
fn run( fn run(
&self, &self,
_engine_state: &EngineState, _engine_state: &EngineState,

View file

@ -22,6 +22,10 @@ impl Command for SubCommand {
"Convert the date into a structured table." "Convert the date into a structured table."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["date", "to", "record", "structured", "table"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -22,6 +22,10 @@ impl Command for SubCommand {
"Convert the date into a structured table." "Convert the date into a structured table."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["date", "to", "record", "structured", "table"]
}
fn run( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -32,6 +32,20 @@ impl Command for SubCommand {
"Use 'date list-timezone' to list all supported time zones." "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( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -17,6 +17,10 @@ impl Command for Cd {
"Change directory." "Change directory."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["cd", "change", "directory", "dir", "folder", "switch"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("cd") Signature::build("cd")
.optional("path", SyntaxShape::Directory, "the path to change to") .optional("path", SyntaxShape::Directory, "the path to change to")

View file

@ -28,6 +28,10 @@ impl Command for Cp {
"Copy files." "Copy files."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["cp", "copy", "file", "files"]
}
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("cp") Signature::build("cp")
.required("source", SyntaxShape::GlobPattern, "the place to copy from") .required("source", SyntaxShape::GlobPattern, "the place to copy from")

View file

@ -32,6 +32,10 @@ impl Command for Glob {
"Creates a list of files and/or folders based on the glob pattern provided." "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> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {

View file

@ -32,6 +32,18 @@ impl Command for Mkdir {
"Make directories, creates intermediary directories as required." "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( fn run(
&self, &self,
engine_state: &EngineState, engine_state: &EngineState,

View file

@ -29,6 +29,10 @@ impl Command for Mv {
"Move files or directories." "Move files or directories."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["mv", "move"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("mv") Signature::build("mv")
.required( .required(

View file

@ -25,6 +25,10 @@ impl Command for Open {
"Load a file into a cell, converting to table if possible (avoid by appending '--raw')." "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 { fn signature(&self) -> nu_protocol::Signature {
Signature::build("open") Signature::build("open")
.optional("filename", SyntaxShape::Filepath, "the filename to use") .optional("filename", SyntaxShape::Filepath, "the filename to use")

View file

@ -38,6 +38,10 @@ impl Command for Rm {
"Remove file(s)." "Remove file(s)."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["rm", "remove"]
}
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
let sig = Signature::build("rm"); let sig = Signature::build("rm");
#[cfg(all( #[cfg(all(

View file

@ -20,6 +20,10 @@ impl Command for Save {
"Save a file." "Save a file."
} }
fn search_terms(&self) -> Vec<&str> {
vec!["save", "write", "write_file"]
}
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("save") Signature::build("save")
.required("filename", SyntaxShape::Filepath, "the filename to use") .required("filename", SyntaxShape::Filepath, "the filename to use")

View file

@ -24,6 +24,10 @@ impl Command for Touch {
"touch" "touch"
} }
fn search_terms(&self) -> Vec<&str> {
vec!["touch"]
}
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("touch") Signature::build("touch")
.required( .required(