mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +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 |
||
---|---|---|
.. | ||
src | ||
build.rs | ||
Cargo.toml | ||
LICENSE |