mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:55:59 +02:00
refactor(get,select,reject)!: deprecate --ignore-errors in favor of --optional (#16007)
# Description As decided on the team meeting on 2025-06-19, rename `--ignore-errors (-i)` to `--optional (-o)` with a (currently) indefinite grace period. After `--ignore-errors (-i)` is removed, the short flag `-i` can be used for `--ignore-case` (not implemented as of this PR) # User-Facing Changes `get`/`select`/`reject`: rename `--ignore-errors (-i)` to `--optional (-o)` to better reflect its behavior. # Tests + Formatting - 🟢 toolkit fmt - 🟢 toolkit clippy - 🟢 toolkit test - 🟢 toolkit test stdlib # After Submitting Update docs and inform third parties that integrate with nushell. --------- Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
This commit is contained in:
@ -31,7 +31,7 @@ fn adds_row_data_if_column_missing() {
|
||||
|
||||
#[test]
|
||||
fn default_after_empty_filter() {
|
||||
let actual = nu!("[a b] | where $it == 'c' | get -i 0 | default 'd'");
|
||||
let actual = nu!("[a b] | where $it == 'c' | get -o 0 | default 'd'");
|
||||
|
||||
assert_eq!(actual.out, "d");
|
||||
}
|
||||
|
@ -196,14 +196,14 @@ fn get_does_not_delve_too_deep_in_nested_lists() {
|
||||
|
||||
#[test]
|
||||
fn ignore_errors_works() {
|
||||
let actual = nu!(r#" let path = "foo"; {} | get -i $path | to nuon "#);
|
||||
let actual = nu!(r#" let path = "foo"; {} | get -o $path | to nuon "#);
|
||||
|
||||
assert_eq!(actual.out, "null");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignore_multiple() {
|
||||
let actual = nu!(r#"[[a];[b]] | get -i c d | to nuon"#);
|
||||
let actual = nu!(r#"[[a];[b]] | get -o c d | to nuon"#);
|
||||
|
||||
assert_eq!(actual.out, "[[null], [null]]");
|
||||
}
|
||||
|
@ -174,14 +174,14 @@ fn reject_multiple_rows_descending() {
|
||||
|
||||
#[test]
|
||||
fn test_ignore_errors_flag() {
|
||||
let actual = nu!("[[a, b]; [1, 2], [3, 4], [5, 6]] | reject 5 -i | to nuon");
|
||||
let actual = nu!("[[a, b]; [1, 2], [3, 4], [5, 6]] | reject 5 -o | to nuon");
|
||||
assert_eq!(actual.out, "[[a, b]; [1, 2], [3, 4], [5, 6]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ignore_errors_flag_var() {
|
||||
let actual =
|
||||
nu!("let arg = [5 c]; [[a, b]; [1, 2], [3, 4], [5, 6]] | reject ...$arg -i | to nuon");
|
||||
nu!("let arg = [5 c]; [[a, b]; [1, 2], [3, 4], [5, 6]] | reject ...$arg -o | to nuon");
|
||||
assert_eq!(actual.out, "[[a, b]; [1, 2], [3, 4], [5, 6]]");
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ fn select_repeated_column() {
|
||||
fn ignore_errors_works() {
|
||||
let actual = nu!(r#"
|
||||
let path = "foo";
|
||||
[{}] | select -i $path | to nuon
|
||||
[{}] | select -o $path | to nuon
|
||||
"#);
|
||||
|
||||
assert_eq!(actual.out, "[[foo]; [null]]");
|
||||
|
@ -326,7 +326,7 @@ fn from_csv_text_with_missing_columns_to_table() {
|
||||
r#"
|
||||
open los_tres_caballeros.txt
|
||||
| from csv --flexible
|
||||
| get -i rusty_luck
|
||||
| get -o rusty_luck
|
||||
| compact
|
||||
| length
|
||||
"#
|
||||
|
@ -245,7 +245,7 @@ fn from_tsv_text_with_missing_columns_to_table() {
|
||||
r#"
|
||||
open los_tres_caballeros.txt
|
||||
| from tsv --flexible
|
||||
| get -i rusty_luck
|
||||
| get -o rusty_luck
|
||||
| compact
|
||||
| length
|
||||
"#
|
||||
|
Reference in New Issue
Block a user