Files
nushell/crates/nu-command
Bahex 172a0c44bd fix(get): to be consistent with regular cell-path access on null values (#16155)
# Description
Cell-path accesses on `null` values throw an error, unless the initial
cell-path member is optional:
```nushell
">"; (null).a
# => Error: nu:🐚:incompatible_path_access
# => 
# =>   x Data cannot be accessed with a cell path
# =>    ,-[source:1:8]
# =>  1 | (null).a
# =>    :        |
# =>    :        `-- nothing doesn't support cell paths
# =>    `----

">"; (null).a? | describe
# => nothing
```

`get` throws an error on `null` even when the cell-path is optional, and
only returns `null` quietly with the `--ignore-errors` flag
```nushell
">"; null | get a?
# => Error: nu:🐚:only_supports_this_input_type
# => 
# =>   x Input type not supported.
# =>    ,-[source:1:1]
# =>  1 | null | get a?
# =>    : ^^|^   ^|^
# =>    :   |     `-- only table or record input data is supported
# =>    :   `-- input type: nothing
# =>    `----

">"; null | get -i a? | describe
# => nothing
```

# Tests + Formatting
No breakage.

# After Submitting
N/A

Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
2025-07-11 12:32:31 -04:00
..

This crate contains the majority of our commands

We allow ourselves to move some of the commands in nu-command to nu-cmd-* crates as needed.

Internal Nushell crate

This crate implements components of Nushell and is not designed to support plugin authors or other users directly.