Mildly edited a small handful of help messages (#6868)

* Edited a handful of help messages

* Remove line break as instructed by clippy
This commit is contained in:
Leon 2022-10-23 16:02:52 +10:00 committed by GitHub
parent e49b359848
commit 24a98f8999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 41 additions and 38 deletions

View file

@ -50,7 +50,7 @@ pub fn evaluate_repl(
if !atty::is(atty::Stream::Stdin) { if !atty::is(atty::Stream::Stdin) {
return Err(std::io::Error::new( return Err(std::io::Error::new(
std::io::ErrorKind::NotFound, std::io::ErrorKind::NotFound,
"Nushell launched as interactive REPL but STDIN is not a TTY, either launch in a valid terminal or provide arguments to invoke a script!", "Nushell launched as a REPL, but STDIN is not a TTY; either launch in a valid terminal or provide arguments to invoke a script!",
)) ))
.into_diagnostic(); .into_diagnostic();
} }

View file

@ -19,7 +19,7 @@ impl Command for GroupByDb {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Group by query" "Group-by query"
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {

View file

@ -103,14 +103,14 @@ impl SQLContext {
let idx = match idx.parse::<usize>() { let idx = match idx.parse::<usize>() {
Ok(0)| Err(_) => Err( Ok(0)| Err(_) => Err(
PolarsError::ComputeError( PolarsError::ComputeError(
format!("Group By Error: Only positive number or expression are supported, got {idx}").into() format!("Group-By Error: Only positive number or expression are supported, got {idx}").into()
)), )),
Ok(idx) => Ok(idx) Ok(idx) => Ok(idx)
}?; }?;
Ok(projection[idx].clone()) Ok(projection[idx].clone())
} }
SqlExpr::Value(_) => Err( SqlExpr::Value(_) => Err(
PolarsError::ComputeError("Group By Error: Only positive number or expression are supported".into()) PolarsError::ComputeError("Group-By Error: Only positive number or expression are supported".into())
), ),
_ => parse_sql_expr(e) _ => parse_sql_expr(e)
} }
@ -124,7 +124,7 @@ impl SQLContext {
// Return error on wild card, shouldn't process this // Return error on wild card, shouldn't process this
if contain_wildcard { if contain_wildcard {
return Err(PolarsError::ComputeError( return Err(PolarsError::ComputeError(
"Group By Error: Can't processed wildcard in groupby".into(), "Group-By Error: Can't process wildcard in group-by".into(),
)); ));
} }
// Default polars group by will have group by columns at the front // Default polars group by will have group by columns at the front

View file

@ -15,7 +15,7 @@ impl Command for ToDataFrame {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Converts a List, Table or Dictionary into a dataframe" "Converts a list, table or record into a dataframe"
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {

View file

@ -243,7 +243,7 @@ expr_command!(
"max", "max",
"Creates a max expression", "Creates a max expression",
vec![Example { vec![Example {
description: "Max aggregation for a group by", description: "Max aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a
@ -274,7 +274,7 @@ expr_command!(
"min", "min",
"Creates a min expression", "Creates a min expression",
vec![Example { vec![Example {
description: "Min aggregation for a group by", description: "Min aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a
@ -305,7 +305,7 @@ expr_command!(
"sum", "sum",
"Creates a sum expression for an aggregation", "Creates a sum expression for an aggregation",
vec![Example { vec![Example {
description: "Sum aggregation for a group by", description: "Sum aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a
@ -336,7 +336,7 @@ expr_command!(
"mean", "mean",
"Creates a mean expression for an aggregation", "Creates a mean expression for an aggregation",
vec![Example { vec![Example {
description: "Mean aggregation for a group by", description: "Mean aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a
@ -367,7 +367,7 @@ expr_command!(
"median", "median",
"Creates a median expression for an aggregation", "Creates a median expression for an aggregation",
vec![Example { vec![Example {
description: "Median aggregation for a group by", description: "Median aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a
@ -398,7 +398,7 @@ expr_command!(
"std", "std",
"Creates a std expression for an aggregation", "Creates a std expression for an aggregation",
vec![Example { vec![Example {
description: "Std aggregation for a group by", description: "Std aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 2] [two 1] [two 1]] example: r#"[[a b]; [one 2] [one 2] [two 1] [two 1]]
| into df | into df
| group-by a | group-by a
@ -429,7 +429,7 @@ expr_command!(
"var", "var",
"Create a var expression for an aggregation", "Create a var expression for an aggregation",
vec![Example { vec![Example {
description: "Var aggregation for a group by", description: "Var aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 2] [two 1] [two 1]] example: r#"[[a b]; [one 2] [one 2] [two 1] [two 1]]
| into df | into df
| group-by a | group-by a

View file

@ -33,7 +33,7 @@ impl Command for ExprQuantile {
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![Example { vec![Example {
description: "Quantile aggregation for a group by", description: "Quantile aggregation for a group-by",
example: r#"[[a b]; [one 2] [one 4] [two 1]] example: r#"[[a b]; [one 2] [one 4] [two 1]]
| into df | into df
| group-by a | group-by a

View file

@ -17,13 +17,13 @@ impl Command for LazyAggregate {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Performs a series of aggregations from a group by" "Performs a series of aggregations from a group-by"
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build(self.name()) Signature::build(self.name())
.rest( .rest(
"Group by expressions", "Group-by expressions",
SyntaxShape::Any, SyntaxShape::Any,
"Expression(s) that define the aggregations to be applied", "Expression(s) that define the aggregations to be applied",
) )

View file

@ -16,15 +16,15 @@ impl Command for ToLazyGroupBy {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Creates a groupby object that can be used for other aggregations" "Creates a group-by object that can be used for other aggregations"
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build(self.name()) Signature::build(self.name())
.rest( .rest(
"Group by expressions", "Group-by expressions",
SyntaxShape::Any, SyntaxShape::Any,
"Expression(s) that define the lazy group by", "Expression(s) that define the lazy group-by",
) )
.input_type(Type::Custom("dataframe".into())) .input_type(Type::Custom("dataframe".into()))
.output_type(Type::Custom("dataframe".into())) .output_type(Type::Custom("dataframe".into()))

View file

@ -274,45 +274,44 @@ impl Command for Ls {
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {
description: "List all files in the current directory", description: "List visible files in the current directory",
example: "ls", example: "ls",
result: None, result: None,
}, },
Example { Example {
description: "List all files in a subdirectory", description: "List visible files in a subdirectory",
example: "ls subdir", example: "ls subdir",
result: None, result: None,
}, },
Example { Example {
description: "List all files with full path in the parent directory", description: "List visible files with full path in the parent directory",
example: "ls -f ..", example: "ls -f ..",
result: None, result: None,
}, },
Example { Example {
description: "List all rust files", description: "List Rust files",
example: "ls *.rs", example: "ls *.rs",
result: None, result: None,
}, },
Example { Example {
description: "List all files and directories whose name do not contain 'bar'", description: "List files and directories whose name do not contain 'bar'",
example: "ls -s | where name !~ bar", example: "ls -s | where name !~ bar",
result: None, result: None,
}, },
Example { Example {
description: "List all dirs in your home directory", description: "List all dirs in your home directory",
example: "ls ~ | where type == dir", example: "ls -a ~ | where type == dir",
result: None, result: None,
}, },
Example { Example {
description: description:
"List all dirs in your home directory which have not been modified in 7 days", "List all dirs in your home directory which have not been modified in 7 days",
example: "ls -s ~ | where type == dir && modified < ((date now) - 7day)", example: "ls -as ~ | where type == dir && modified < ((date now) - 7day)",
result: None, result: None,
}, },
Example { Example {
description: "List given paths, show directories themselves", description: "List given paths and show directories themselves",
example: example: "['/path/to/directory' '/path/to/file'] | each { ls -D $in } | flatten",
"['/path/to/directory' '/path/to/file'] | each { |it| ls -D $it } | flatten",
result: None, result: None,
}, },
] ]

View file

@ -26,7 +26,7 @@ impl Command for Drop {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Remove the last number of rows or columns." "Remove the last several rows of the input. Counterpart of 'skip'. Opposite of 'last'."
} }
fn search_terms(&self) -> Vec<&str> { fn search_terms(&self) -> Vec<&str> {

View file

@ -25,7 +25,7 @@ impl Command for First {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Show only the first number of rows." "Return only the first several rows of the input. Counterpart of 'last'. Opposite of 'skip'."
} }
fn run( fn run(

View file

@ -25,7 +25,7 @@ impl Command for GroupBy {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Create a new table grouped." "Split a table into groups based on one column's values, and return a record with those groups."
} }
fn run( fn run(
@ -42,12 +42,12 @@ impl Command for GroupBy {
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {
vec![ vec![
Example { Example {
description: "group items by column named \"type\"", description: "Group items by the \"type\" column's values",
example: r#"ls | group-by type"#, example: r#"ls | group-by type"#,
result: None, result: None,
}, },
Example { Example {
description: "you can also group by raw values by leaving out the argument", description: "You can also group by raw values by leaving out the argument",
example: "echo ['1' '3' '1' '3' '2' '1' '1'] | group-by", example: "echo ['1' '3' '1' '3' '2' '1' '1'] | group-by",
result: Some(Value::Record { result: Some(Value::Record {
cols: vec!["1".to_string(), "3".to_string(), "2".to_string()], cols: vec!["1".to_string(), "3".to_string(), "2".to_string()],

View file

@ -26,7 +26,7 @@ impl Command for Last {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Show only the last number of rows." "Return only the last several rows of the input. Counterpart of 'first'. Opposite of 'drop'."
} }
fn examples(&self) -> Vec<Example> { fn examples(&self) -> Vec<Example> {

View file

@ -23,7 +23,11 @@ impl Command for Skip {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Skip the first n elements of the input." "Skip the first several rows of the input. Counterpart of 'drop'. Opposite of 'first'."
}
fn extra_usage(&self) -> &str {
r#"To skip specific numbered rows, try 'drop nth'. To skip specific named columns, try 'reject'."#
} }
fn search_terms(&self) -> Vec<&str> { fn search_terms(&self) -> Vec<&str> {

View file

@ -33,7 +33,7 @@ impl Command for SubCommand {
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {
"Split a path into parts by a separator." "Split a path into a list based on the system's path separator."
} }
fn run( fn run(

View file

@ -159,7 +159,7 @@ impl Command for Table {
let span = Span::test_data(); let span = Span::test_data();
vec![ vec![
Example { Example {
description: "List the files in current directory with index number start from 1.", description: "List the files in current directory, with indexes starting from 1.",
example: r#"ls | table -n 1"#, example: r#"ls | table -n 1"#,
result: None, result: None,
}, },