deprecate --ignore-shell-errors and --ignore-program-errors in do (#14385)

# Description
As title, this pr is going to deprecate `--ignore-shell-errors` and
`--ignore-program-errors`.

Because I think these two flags makes `do` command complicate, and it
should be easy to use `-i` instead.

# User-Facing Changes
After the pr, using these two flags will raise deprecated warning.
```nushell
> do --ignore-program-errors { ^pwd }
Error:   × Deprecated option
   ╭─[entry #2:1:1]
 1 │ do --ignore-program-errors { ^pwd }
   · ─┬
   ·  ╰── `--ignore-program-errors` is deprecated and will be removed in 0.102.0.
   ╰────
  help: Please use the `--ignore-errors(-i)`
/home/windsoilder/projects/nushell
> do --ignore-shell-errors { ^pwd }
Error:   × Deprecated option
   ╭─[entry #3:1:1]
 1 │ do --ignore-shell-errors { ^pwd }
   · ─┬
   ·  ╰── `--ignore-shell-errors` is deprecated and will be removed in 0.102.0.
   ╰────
  help: Please use the `--ignore-errors(-i)`
/home/windsoilder/projects/nushell
```

# Tests + Formatting
NaN
This commit is contained in:
Wind
2024-11-27 09:36:30 +08:00
committed by GitHub
parent 4edce44689
commit e0c0d39ede
3 changed files with 32 additions and 14 deletions

View File

@ -44,7 +44,7 @@ fn do_with_semicolon_break_on_failed_external() {
fn ignore_shell_errors_works_for_external_with_semicolon() {
let actual = nu!(r#"do -s { open asdfasdf.txt }; "text""#);
assert_eq!(actual.err, "");
assert!(actual.err.contains("Deprecated option"));
assert_eq!(actual.out, "text");
}
@ -52,7 +52,7 @@ fn ignore_shell_errors_works_for_external_with_semicolon() {
fn ignore_program_errors_works_for_external_with_semicolon() {
let actual = nu!(r#"do -p { nu -n -c 'exit 1' }; "text""#);
assert_eq!(actual.err, "");
assert!(actual.err.contains("Deprecated option"));
assert_eq!(actual.out, "text");
}
@ -80,6 +80,7 @@ fn run_closure_with_it_using() {
#[test]
fn waits_for_external() {
let actual = nu!(r#"do -p { nu -c 'sleep 1sec; print before; exit 1'}; print after"#);
assert!(actual.err.is_empty());
assert!(actual.err.contains("Deprecated option"));
assert_eq!(actual.out, "beforeafter");
}