From 7d5d53cf85ee75895698a07e6f69c4fb1f55fbff Mon Sep 17 00:00:00 2001 From: HannahZhuSWE <76960450+HannahZhuSWE@users.noreply.github.com> Date: Sat, 15 Oct 2022 13:49:09 -0400 Subject: [PATCH] Add search terms to arg dataframe commands (#6724) * added search terms for arg prefixed dataframe commands * remove search terms that already produce results --- crates/nu-command/src/dataframe/series/arg_max.rs | 4 ++++ crates/nu-command/src/dataframe/series/arg_min.rs | 4 ++++ crates/nu-command/src/dataframe/series/indexes/arg_sort.rs | 4 ++++ crates/nu-command/src/dataframe/series/indexes/arg_true.rs | 4 ++++ crates/nu-command/src/dataframe/series/indexes/arg_unique.rs | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/crates/nu-command/src/dataframe/series/arg_max.rs b/crates/nu-command/src/dataframe/series/arg_max.rs index d9d98a816b..07321e307c 100644 --- a/crates/nu-command/src/dataframe/series/arg_max.rs +++ b/crates/nu-command/src/dataframe/series/arg_max.rs @@ -19,6 +19,10 @@ impl Command for ArgMax { "Return index for max value in series" } + fn search_terms(&self) -> Vec<&str> { + vec!["argmax", "maximum", "most", "largest", "greatest"] + } + fn signature(&self) -> Signature { Signature::build(self.name()) .input_type(Type::Custom("dataframe".into())) diff --git a/crates/nu-command/src/dataframe/series/arg_min.rs b/crates/nu-command/src/dataframe/series/arg_min.rs index 85cb9356a3..bfd7acbf3d 100644 --- a/crates/nu-command/src/dataframe/series/arg_min.rs +++ b/crates/nu-command/src/dataframe/series/arg_min.rs @@ -19,6 +19,10 @@ impl Command for ArgMin { "Return index for min value in series" } + fn search_terms(&self) -> Vec<&str> { + vec!["argmin", "minimum", "least", "smallest", "lowest"] + } + fn signature(&self) -> Signature { Signature::build(self.name()) .input_type(Type::Custom("dataframe".into())) diff --git a/crates/nu-command/src/dataframe/series/indexes/arg_sort.rs b/crates/nu-command/src/dataframe/series/indexes/arg_sort.rs index 449975eba9..3663e18336 100644 --- a/crates/nu-command/src/dataframe/series/indexes/arg_sort.rs +++ b/crates/nu-command/src/dataframe/series/indexes/arg_sort.rs @@ -19,6 +19,10 @@ impl Command for ArgSort { "Returns indexes for a sorted series" } + fn search_terms(&self) -> Vec<&str> { + vec!["argsort", "order", "arrange"] + } + fn signature(&self) -> Signature { Signature::build(self.name()) .switch("reverse", "reverse order", Some('r')) diff --git a/crates/nu-command/src/dataframe/series/indexes/arg_true.rs b/crates/nu-command/src/dataframe/series/indexes/arg_true.rs index 44a3737dd7..07e3620865 100644 --- a/crates/nu-command/src/dataframe/series/indexes/arg_true.rs +++ b/crates/nu-command/src/dataframe/series/indexes/arg_true.rs @@ -19,6 +19,10 @@ impl Command for ArgTrue { "Returns indexes where values are true" } + fn search_terms(&self) -> Vec<&str> { + vec!["argtrue", "truth", "boolean-true"] + } + fn signature(&self) -> Signature { Signature::build(self.name()) .input_type(Type::Custom("dataframe".into())) diff --git a/crates/nu-command/src/dataframe/series/indexes/arg_unique.rs b/crates/nu-command/src/dataframe/series/indexes/arg_unique.rs index 11f60a903d..631551350a 100644 --- a/crates/nu-command/src/dataframe/series/indexes/arg_unique.rs +++ b/crates/nu-command/src/dataframe/series/indexes/arg_unique.rs @@ -19,6 +19,10 @@ impl Command for ArgUnique { "Returns indexes for unique values" } + fn search_terms(&self) -> Vec<&str> { + vec!["argunique", "distinct", "noduplicate", "unrepeated"] + } + fn signature(&self) -> Signature { Signature::build(self.name()) .input_type(Type::Custom("dataframe".into()))