mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
6a274b860a
This is a follow-up to https://github.com/nushell/nushell/pull/8379 and https://github.com/nushell/nushell/discussions/8502. This PR makes it so that the new `?` syntax for marking a path member as optional short-circuits, as voted on in the [8502](https://github.com/nushell/nushell/discussions/8502) poll. Previously, `{ foo: 123 }.bar?.baz` would raise an error: ``` > { foo: 123 }.bar?.baz × Data cannot be accessed with a cell path ╭─[entry #15:1:1] 1 │ { foo: 123 }.bar?.baz · ─┬─ · ╰── nothing doesn't support cell paths ╰──── ``` Here's what was happening: 1. The `bar?` path member access returns `nothing` because there is no field named `bar` on the record 2. The `baz` path member access fails when trying to access a `baz` field on that `nothing` value After this change, `{ foo: 123 }.bar?.baz` returns `nothing`; the failed `bar?` access immediately returns `nothing` and the `baz` access never runs. |
||
---|---|---|
.. | ||
tests | ||
command.rs | ||
config_files.rs | ||
logger.rs | ||
main.rs | ||
README.md | ||
run.rs | ||
signals.rs | ||
terminal.rs | ||
test_bins.rs | ||
tests.rs |
Nushell REPL
This directory contains the main Nushell REPL (read eval print loop) as part of the CLI portion of Nushell, which creates the nu
binary itself.
Current versions of the nu
binary will use the Nu argument parsing logic to parse the commandline arguments passed to nu
, leaving the logic here to be a thin layer around what the core libraries.