nushell/crates
Douglas 8c1ab7e0a3
Add proper config defaults for hooks (#14341)
# Release Notes Excerpt

* Hooks now default to an empty value of the proper type (e.g., `[]` or
`{}`) when not otherwise specified

# Description

```nushell
# Start with no config
nu -n
# Populate with defaults
$env.config = {}
$env.config.hooks
```

* Before: All hooks other than `display_output` were set to `null`.
Attempting to append a hook using `++=` would fail unless it had already
been assigned.
* After:
* `pre_prompt`, `pre_execution`, and `command_not_found` are set to
empty lists. This allows the user to simply append new hooks using
`++=`.
* `env_change` is set to an empty record. This allows the user to add
new hooks using `merge`, although a "helper" command would still be
useful (TODO: stdlib).

Also fixed a typo in an error message.

# User-Facing Changes

There shouldn't be any breaking changes since (before) there were no
guarantees of the hook's value/type. Previously, users would have to
check for `null` and `default` to an empty list before appending. Any
user-strategies for dealing with the problem should continue to work
after this change.

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

Note that, for reasons I cannot ascertain, this PR appears to have
*fixed* the `command_not_found_error_recognizes_non_executable_file`
test that was previously broken by #12953. That PR essentially rewrote
the test to match the new behavior, but it no longer tested what it was
intended to test.

Now, the test is working again as designed (and as it works in the
REPL).

# After Submitting

This will be covered in the Configuration update for #14249. This PR
will simplify several examples in the doc.
2024-11-14 20:27:26 -08:00
..
nu_plugin_custom_values Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_example Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_formats Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_gstat Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_inc Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_nu_example Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_polars Add support for converting polars decimal values to nushell values (#14343) 2024-11-15 12:10:38 +08:00
nu_plugin_python Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_query Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu_plugin_stress_internals Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cli Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-cmd-base Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cmd-extra Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-cmd-lang Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-cmd-plugin Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-color-config Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-command Add proper config defaults for hooks (#14341) 2024-11-14 20:27:26 -08:00
nu-derive-value Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-engine Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-explore Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-glob skip test_iteration_errors if /root is missing (#14299) 2024-11-14 10:13:04 +01:00
nu-json Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-lsp Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-parser Allow duration to be added to date (#14295) 2024-11-14 10:07:37 +01:00
nu-path Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-core Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-engine Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-protocol Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-plugin-test-support Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-pretty-hex Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-protocol Add proper config defaults for hooks (#14341) 2024-11-14 20:27:26 -08:00
nu-std Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-system Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-table Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-term-grid Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nu-test-support Remove the NU_DISABLE_IR option (#14293) 2024-11-15 12:09:25 +08:00
nu-utils Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
nuon Bump to dev version 0.100.1 (#14328) 2024-11-14 10:04:39 +01:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.