Typed argument example
This commit is contained in:
parent
d272f0d3b8
commit
6a97ad9f2d
|
@ -229,22 +229,22 @@ impl Command for Do {
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure, with a positional parameter",
|
description: "Run the closure with a positional, type-checked parameter",
|
||||||
example: r#"do {|x| 100 + $x } 77"#,
|
example: r#"do {|x:int| 100 + $x } 77"#,
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure, with pipeline input",
|
description: "Run the closure with pipeline input",
|
||||||
example: r#"77 | do {100 + $in }"#,
|
example: r#"77 | do { 100 + $in }"#,
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure, with a default parameter value",
|
description: "Run the closure with a default parameter value",
|
||||||
example: r#"77 | do {|x=100| $x + $in }"#,
|
example: r#"77 | do {|x=100| $x + $in }"#,
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Run the closure, with two positional parameters",
|
description: "Run the closure with two positional parameters",
|
||||||
example: r#"do {|x,y| $x + $y } 77 100"#,
|
example: r#"do {|x,y| $x + $y } 77 100"#,
|
||||||
result: Some(Value::test_int(177)),
|
result: Some(Value::test_int(177)),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user