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 {
|
fn usage(&self) -> &str {
|
||||||
"Run a block"
|
"Run a closure, providing it with the pipeline input"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
|
@ -23,25 +23,25 @@ impl Command for Do {
|
||||||
.input_output_types(vec![(Type::Any, Type::Any)])
|
.input_output_types(vec![(Type::Any, Type::Any)])
|
||||||
.switch(
|
.switch(
|
||||||
"ignore-errors",
|
"ignore-errors",
|
||||||
"ignore errors as the block runs",
|
"ignore errors as the closure runs",
|
||||||
Some('i'),
|
Some('i'),
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"ignore-shell-errors",
|
"ignore-shell-errors",
|
||||||
"ignore shell errors as the block runs",
|
"ignore shell errors as the closure runs",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"ignore-program-errors",
|
"ignore-program-errors",
|
||||||
"ignore program errors as the block runs",
|
"ignore external program errors as the closure runs",
|
||||||
Some('p'),
|
Some('p'),
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"capture-errors",
|
"capture-errors",
|
||||||
"capture errors as the block runs and return it",
|
"catch errors as the closure runs, and return them",
|
||||||
Some('c'),
|
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)
|
.category(Category::Core)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,22 +179,22 @@ impl Command for Do {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "Run the block",
|
description: "Run the closure",
|
||||||
example: r#"do { echo hello }"#,
|
example: r#"do { echo hello }"#,
|
||||||
result: Some(Value::test_string("hello")),
|
result: Some(Value::test_string("hello")),
|
||||||
},
|
},
|
||||||
Example {
|
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 }"#,
|
example: r#"do -i { thisisnotarealcommand }"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the block and ignore shell errors",
|
description: "Run the closure and ignore shell errors",
|
||||||
example: r#"do -s { thisisnotarealcommand }"#,
|
example: r#"do -s { thisisnotarealcommand }"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
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""#,
|
example: r#"do -p { nu -c 'exit 1' }; echo "I'll still run""#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
|
@ -204,12 +204,12 @@ impl Command for Do {
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the block, with a positional parameter",
|
description: "Run the closure, with a positional parameter",
|
||||||
example: r#"do {|x| 100 + $x } 77"#,
|
example: r#"do {|x| 100 + $x } 77"#,
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the block, with input",
|
description: "Run the closure, with input",
|
||||||
example: r#"77 | do {|x| 100 + $in }"#,
|
example: r#"77 | do {|x| 100 + $in }"#,
|
||||||
result: None, // TODO: returns 177
|
result: None, // TODO: returns 177
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,7 +47,7 @@ with 'transpose' first."#
|
||||||
.switch("keep-empty", "keep empty result cells", Some('k'))
|
.switch("keep-empty", "keep empty result cells", Some('k'))
|
||||||
.switch(
|
.switch(
|
||||||
"numbered",
|
"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'),
|
Some('n'),
|
||||||
)
|
)
|
||||||
.category(Category::Filters)
|
.category(Category::Filters)
|
||||||
|
|
|
@ -35,7 +35,7 @@ impl Command for EachWhile {
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"numbered",
|
"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'),
|
Some('n'),
|
||||||
)
|
)
|
||||||
.category(Category::Filters)
|
.category(Category::Filters)
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl Command for Insert {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
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> {
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl Command for ParEach {
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"numbered",
|
"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'),
|
Some('n'),
|
||||||
)
|
)
|
||||||
.category(Category::Filters)
|
.category(Category::Filters)
|
||||||
|
|
|
@ -36,13 +36,13 @@ impl Command for Reduce {
|
||||||
)
|
)
|
||||||
.switch(
|
.switch(
|
||||||
"numbered",
|
"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'),
|
Some('n'),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
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> {
|
fn search_terms(&self) -> Vec<&str> {
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl Command for Update {
|
||||||
.required(
|
.required(
|
||||||
"replacement value",
|
"replacement value",
|
||||||
SyntaxShape::Any,
|
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)
|
.category(Category::Filters)
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ impl Command for Update {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
Example {
|
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 }",
|
example: "[[count fruit]; [1 'apple']] | update count {|row index| ($row.fruit | str length) + $index }",
|
||||||
result: Some(Value::List {
|
result: Some(Value::List {
|
||||||
vals: vec![Value::Record {
|
vals: vec![Value::Record {
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl Command for Upsert {
|
||||||
.required(
|
.required(
|
||||||
"replacement value",
|
"replacement value",
|
||||||
SyntaxShape::Any,
|
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)
|
.category(Category::Filters)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user