Added two examples (and fixed another)
This commit is contained in:
parent
7d2d573eb8
commit
d272f0d3b8
|
@ -234,9 +234,19 @@ impl Command for Do {
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure, with input",
|
description: "Run the closure, with pipeline input",
|
||||||
example: r#"77 | do {|x| 100 + $in }"#,
|
example: r#"77 | do {100 + $in }"#,
|
||||||
result: None, // TODO: returns 177
|
result: Some(Value::test_int(177)),
|
||||||
|
},
|
||||||
|
Example {
|
||||||
|
description: "Run the closure, with a default parameter value",
|
||||||
|
example: r#"77 | do {|x=100| $x + $in }"#,
|
||||||
|
result: Some(Value::test_int(177)),
|
||||||
|
},
|
||||||
|
Example {
|
||||||
|
description: "Run the closure, with two positional parameters",
|
||||||
|
example: r#"do {|x,y| $x + $y } 77 100"#,
|
||||||
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure and keep changes to the environment",
|
description: "Run the closure and keep changes to the environment",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user