nushell/src
Reilly Wood 6a274b860a
Cell paths: make optional path members short-circuit (#8554)
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.
2023-03-23 09:54:19 +13:00
..
tests Cell paths: make optional path members short-circuit (#8554) 2023-03-23 09:54:19 +13:00
command.rs feat: add a command_not_found hook (#8314) 2023-03-20 17:05:22 +13:00
config_files.rs feat: add a command_not_found hook (#8314) 2023-03-20 17:05:22 +13:00
logger.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00
main.rs feat: add a command_not_found hook (#8314) 2023-03-20 17:05:22 +13:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
run.rs FEATURE: add the startup time to $nu (#8353) 2023-03-09 14:18:58 -06:00
signals.rs Cleanup of src/main.rs (#7801) 2023-01-20 10:44:49 -08:00
terminal.rs Move all functions of main.rs into modules (#7803) 2023-01-20 13:20:38 -08:00
test_bins.rs feat: add a command_not_found hook (#8314) 2023-03-20 17:05:22 +13:00
tests.rs fix: fix commandline when called with no arguments (#8207) 2023-03-16 17:45:35 -05:00

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.