remove relative examples, and use report_shell_warning instead of report_shell_error

This commit is contained in:
WindSoilder 2024-11-20 19:21:55 +08:00
parent f11571c55d
commit 95828146a5

View File

@ -71,7 +71,7 @@ impl Command for Do {
let ignore_all_errors = call.has_flag(engine_state, caller_stack, "ignore-errors")?; let ignore_all_errors = call.has_flag(engine_state, caller_stack, "ignore-errors")?;
if call.has_flag(engine_state, caller_stack, "ignore-shell-errors")? { if call.has_flag(engine_state, caller_stack, "ignore-shell-errors")? {
nu_protocol::report_shell_error( nu_protocol::report_shell_warning(
engine_state, engine_state,
&ShellError::GenericError { &ShellError::GenericError {
error: "Deprecated option".into(), error: "Deprecated option".into(),
@ -84,7 +84,7 @@ impl Command for Do {
); );
} }
if call.has_flag(engine_state, caller_stack, "ignore-program-errors")? { if call.has_flag(engine_state, caller_stack, "ignore-program-errors")? {
nu_protocol::report_shell_error( nu_protocol::report_shell_warning(
engine_state, engine_state,
&ShellError::GenericError { &ShellError::GenericError {
error: "Deprecated option".into(), error: "Deprecated option".into(),
@ -235,16 +235,6 @@ impl Command for Do {
example: r#"do --ignore-errors { thisisnotarealcommand }"#, example: r#"do --ignore-errors { thisisnotarealcommand }"#,
result: None, result: None,
}, },
Example {
description: "Run the closure and ignore shell errors",
example: r#"do --ignore-shell-errors { thisisnotarealcommand }"#,
result: None,
},
Example {
description: "Run the closure and ignore external program errors",
example: r#"do --ignore-program-errors { nu --commands 'exit 1' }; echo "I'll still run""#,
result: None,
},
Example { Example {
description: "Abort the pipeline if a program returns a non-zero exit code", description: "Abort the pipeline if a program returns a non-zero exit code",
example: r#"do --capture-errors { nu --commands 'exit 1' } | myscarycommand"#, example: r#"do --capture-errors { nu --commands 'exit 1' } | myscarycommand"#,