mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 15:39:06 +01:00
626410b2aa
# Description this PR - refactors `ErrorMake::run` to avoid duplicate branches depending on the value of `--unspanned` - completes the examples 1. show a really simple `error make` call, without any command definition 2. show a complete error format with all possible fields 3. the command definition but with indentation and slightly better description - adds results to the first two examples - gives meaningful error messages for all known "bad" error formats, using the span of the error format or the span of `$format.label` to better explain why the format is bad # User-Facing Changes users have now the following help ```bash Examples: Create a simple custom error > error make {msg: "my custom error message"} Create a more complex custom error > error make { msg: "my custom error message" label: { text: "my custom label text" # not mandatory unless $.label exists start: 123 # not mandatory unless $.label.end is set end: 456 # not mandatory unless $.label.start is set } } Create a custom error for a custom command that shows the span of the argument > def foo [x] { let span = (metadata $x).span; error make { msg: "this is fishy" label: { text: "fish right here" start: $span.start end: $span.end } } } ``` and the following error messages when the error format is bad https://asciinema.org/a/568107 🥳 # Tests + Formatting - 🟢 `cargo fmt --all` - 🟢 `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` - 🔴 `cargo test --workspace` => the tests do not pass but they do not pass on latest `main` either => i should `cargo clean`, but that's an expensive operation on my machine... # After Submitting the documentation would have to be regenerated over on the website |
||
---|---|---|
.. | ||
nu_plugin_custom_values | ||
nu_plugin_example | ||
nu_plugin_formats | ||
nu_plugin_gstat | ||
nu_plugin_inc | ||
nu_plugin_python | ||
nu_plugin_query | ||
nu-cli | ||
nu-cmd-lang | ||
nu-color-config | ||
nu-command | ||
nu-engine | ||
nu-explore | ||
nu-glob | ||
nu-json | ||
nu-parser | ||
nu-path | ||
nu-plugin | ||
nu-pretty-hex | ||
nu-protocol | ||
nu-system | ||
nu-table | ||
nu-term-grid | ||
nu-test-support | ||
nu-utils | ||
README.md |
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.