Improve do command docs (#6975)

This commit is contained in:
Alex Saveau 2022-11-04 11:50:56 -07:00 committed by GitHub
parent 2c4048eb43
commit 36ae384fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ impl Command for Do {
.required("block", SyntaxShape::Any, "the block to run") .required("block", SyntaxShape::Any, "the block to run")
.switch( .switch(
"ignore-errors", "ignore-errors",
"ignore errors as the block runs", "ignore shell errors as the block runs",
Some('i'), Some('i'),
) )
.switch( .switch(
@ -186,10 +186,15 @@ impl Command for Do {
result: Some(Value::test_string("hello")), result: Some(Value::test_string("hello")),
}, },
Example { Example {
description: "Run the block and ignore errors", description: "Run the block and ignore shell errors",
example: r#"do -i { thisisnotarealcommand }"#, example: r#"do -i { thisisnotarealcommand }"#,
result: None, result: None,
}, },
Example {
description: "Abort the pipeline if a program returns a non-zero exit code",
example: r#"do -c { nu -c 'exit 1' } | myscarycommand"#,
result: None,
},
Example { Example {
description: "Run the block, with a positional parameter", description: "Run the block, with a positional parameter",
example: r#"do {|x| 100 + $x } 50"#, example: r#"do {|x| 100 + $x } 50"#,