mirror of
https://github.com/nushell/nushell.git
synced 2025-01-22 22:29:10 +01:00
Help messages: edit various instances of "block" to "closure" (#7470)
This commit is contained in:
parent
c19d9597fd
commit
52278f8562
@ -14,7 +14,7 @@ impl Command for Do {
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Run a block"
|
||||
"Run a closure, providing it with the pipeline input"
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
@ -23,25 +23,25 @@ impl Command for Do {
|
||||
.input_output_types(vec![(Type::Any, Type::Any)])
|
||||
.switch(
|
||||
"ignore-errors",
|
||||
"ignore errors as the block runs",
|
||||
"ignore errors as the closure runs",
|
||||
Some('i'),
|
||||
)
|
||||
.switch(
|
||||
"ignore-shell-errors",
|
||||
"ignore shell errors as the block runs",
|
||||
"ignore shell errors as the closure runs",
|
||||
Some('s'),
|
||||
)
|
||||
.switch(
|
||||
"ignore-program-errors",
|
||||
"ignore program errors as the block runs",
|
||||
"ignore external program errors as the closure runs",
|
||||
Some('p'),
|
||||
)
|
||||
.switch(
|
||||
"capture-errors",
|
||||
"capture errors as the block runs and return it",
|
||||
"catch errors as the closure runs, and return them",
|
||||
Some('c'),
|
||||
)
|
||||
.rest("rest", SyntaxShape::Any, "the parameter(s) for the block")
|
||||
.rest("rest", SyntaxShape::Any, "the parameter(s) for the closure")
|
||||
.category(Category::Core)
|
||||
}
|
||||
|
||||
@ -179,22 +179,22 @@ impl Command for Do {
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Run the block",
|
||||
description: "Run the closure",
|
||||
example: r#"do { echo hello }"#,
|
||||
result: Some(Value::test_string("hello")),
|
||||
},
|
||||
Example {
|
||||
description: "Run the block and ignore both shell and program errors",
|
||||
description: "Run the closure and ignore both shell and external program errors",
|
||||
example: r#"do -i { thisisnotarealcommand }"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Run the block and ignore shell errors",
|
||||
description: "Run the closure and ignore shell errors",
|
||||
example: r#"do -s { thisisnotarealcommand }"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Run the block and ignore program errors",
|
||||
description: "Run the closure and ignore external program errors",
|
||||
example: r#"do -p { nu -c 'exit 1' }; echo "I'll still run""#,
|
||||
result: None,
|
||||
},
|
||||
@ -204,12 +204,12 @@ impl Command for Do {
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Run the block, with a positional parameter",
|
||||
description: "Run the closure, with a positional parameter",
|
||||
example: r#"do {|x| 100 + $x } 77"#,
|
||||
result: Some(Value::test_int(177)),
|
||||
},
|
||||
Example {
|
||||
description: "Run the block, with input",
|
||||
description: "Run the closure, with input",
|
||||
example: r#"77 | do {|x| 100 + $in }"#,
|
||||
result: None, // TODO: returns 177
|
||||
},
|
||||
|
@ -47,7 +47,7 @@ with 'transpose' first."#
|
||||
.switch("keep-empty", "keep empty result cells", Some('k'))
|
||||
.switch(
|
||||
"numbered",
|
||||
"iterate with an index (deprecated; use a two-parameter block instead)",
|
||||
"iterate with an index (deprecated; use a two-parameter closure instead)",
|
||||
Some('n'),
|
||||
)
|
||||
.category(Category::Filters)
|
||||
|
@ -35,7 +35,7 @@ impl Command for EachWhile {
|
||||
)
|
||||
.switch(
|
||||
"numbered",
|
||||
"iterate with an index (deprecated; use a two-parameter block instead)",
|
||||
"iterate with an index (deprecated; use a two-parameter closure instead)",
|
||||
Some('n'),
|
||||
)
|
||||
.category(Category::Filters)
|
||||
|
@ -38,7 +38,7 @@ impl Command for Insert {
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Insert a new column, using an expression or block to create each row's values."
|
||||
"Insert a new column, using an expression or closure to create each row's values."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
|
@ -34,7 +34,7 @@ impl Command for ParEach {
|
||||
)
|
||||
.switch(
|
||||
"numbered",
|
||||
"iterate with an index (deprecated; use a two-parameter block instead)",
|
||||
"iterate with an index (deprecated; use a two-parameter closure instead)",
|
||||
Some('n'),
|
||||
)
|
||||
.category(Category::Filters)
|
||||
|
@ -36,13 +36,13 @@ impl Command for Reduce {
|
||||
)
|
||||
.switch(
|
||||
"numbered",
|
||||
"iterate with an index (deprecated; use a 3-parameter block instead)",
|
||||
"iterate with an index (deprecated; use a 3-parameter closure instead)",
|
||||
Some('n'),
|
||||
)
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Aggregate a list to a single value using an accumulator block."
|
||||
"Aggregate a list to a single value using an accumulator closure."
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
|
@ -25,7 +25,7 @@ impl Command for Update {
|
||||
.required(
|
||||
"replacement value",
|
||||
SyntaxShape::Any,
|
||||
"the new value to give the cell(s), or a block to create the value",
|
||||
"the new value to give the cell(s), or a closure to create the value",
|
||||
)
|
||||
.category(Category::Filters)
|
||||
}
|
||||
@ -56,7 +56,7 @@ impl Command for Update {
|
||||
}),
|
||||
},
|
||||
Example {
|
||||
description: "Use in block form for more involved updating logic",
|
||||
description: "Use in closure form for more involved updating logic",
|
||||
example: "[[count fruit]; [1 'apple']] | update count {|row index| ($row.fruit | str length) + $index }",
|
||||
result: Some(Value::List {
|
||||
vals: vec![Value::Record {
|
||||
|
@ -25,7 +25,7 @@ impl Command for Upsert {
|
||||
.required(
|
||||
"replacement value",
|
||||
SyntaxShape::Any,
|
||||
"the new value to give the cell(s), or a block to create the value",
|
||||
"the new value to give the cell(s), or a closure to create the value",
|
||||
)
|
||||
.category(Category::Filters)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user