From 52278f8562c3f6c3cf9663c3c71da0b073bb6bf6 Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 14 Dec 2022 23:02:41 +1000 Subject: [PATCH] Help messages: edit various instances of "block" to "closure" (#7470) --- crates/nu-command/src/core_commands/do_.rs | 24 ++++++++++----------- crates/nu-command/src/filters/each.rs | 2 +- crates/nu-command/src/filters/each_while.rs | 2 +- crates/nu-command/src/filters/insert.rs | 2 +- crates/nu-command/src/filters/par_each.rs | 2 +- crates/nu-command/src/filters/reduce.rs | 4 ++-- crates/nu-command/src/filters/update.rs | 4 ++-- crates/nu-command/src/filters/upsert.rs | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/crates/nu-command/src/core_commands/do_.rs b/crates/nu-command/src/core_commands/do_.rs index 2a9f2eb54..b7f6a9ee0 100644 --- a/crates/nu-command/src/core_commands/do_.rs +++ b/crates/nu-command/src/core_commands/do_.rs @@ -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 { 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 }, diff --git a/crates/nu-command/src/filters/each.rs b/crates/nu-command/src/filters/each.rs index 9acae0fbe..90f67d4a3 100644 --- a/crates/nu-command/src/filters/each.rs +++ b/crates/nu-command/src/filters/each.rs @@ -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) diff --git a/crates/nu-command/src/filters/each_while.rs b/crates/nu-command/src/filters/each_while.rs index 3776c8002..a226bb0e8 100644 --- a/crates/nu-command/src/filters/each_while.rs +++ b/crates/nu-command/src/filters/each_while.rs @@ -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) diff --git a/crates/nu-command/src/filters/insert.rs b/crates/nu-command/src/filters/insert.rs index 9e265c430..985e6614b 100644 --- a/crates/nu-command/src/filters/insert.rs +++ b/crates/nu-command/src/filters/insert.rs @@ -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> { diff --git a/crates/nu-command/src/filters/par_each.rs b/crates/nu-command/src/filters/par_each.rs index ee668696b..53798a34a 100644 --- a/crates/nu-command/src/filters/par_each.rs +++ b/crates/nu-command/src/filters/par_each.rs @@ -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) diff --git a/crates/nu-command/src/filters/reduce.rs b/crates/nu-command/src/filters/reduce.rs index 494edc5bf..5f50308dc 100644 --- a/crates/nu-command/src/filters/reduce.rs +++ b/crates/nu-command/src/filters/reduce.rs @@ -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> { diff --git a/crates/nu-command/src/filters/update.rs b/crates/nu-command/src/filters/update.rs index b461230ea..e8bfc5fdf 100644 --- a/crates/nu-command/src/filters/update.rs +++ b/crates/nu-command/src/filters/update.rs @@ -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 { diff --git a/crates/nu-command/src/filters/upsert.rs b/crates/nu-command/src/filters/upsert.rs index fd193e0df..8e747bbe4 100644 --- a/crates/nu-command/src/filters/upsert.rs +++ b/crates/nu-command/src/filters/upsert.rs @@ -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) }