nushell/crates/nu-cmd-lang/src/core_commands
Wind 1514b9fbef
don't show result in error make examples (#13296)
# Description
Fixes: #13189 

The issue is caused `error make` returns a `Value::Errror`, and when
nushell pass it to `table -e` in `std help`, it directly stop and render
the error message.
To solve it, I think it's safe to make these examples return None
directly, it doesn't change the reult of `help error make`.

# User-Facing Changes
## Before
```nushell
~> help "error make"
Error: nu:🐚:eval_block_with_input

  × Eval block failed with pipeline input
     ╭─[NU_STDLIB_VIRTUAL_DIR/std/help.nu:692:21]
 691 │ ] {
 692 │     let commands = (scope commands | sort-by name)
     ·                     ───────┬──────
     ·                            ╰── source value
 693 │
     ╰────

Error:   × my custom error message
```

## After
```nushell
Create an error.

Search terms: panic, crash, throw

Category: core

This command:
- does not create a scope.
- is a built-in command.
- is a subcommand.
- is not part of a plugin.
- is not a custom command.
- is not a keyword.

Usage:
  > error make {flags} <error_struct>


Flags:

  -u, --unspanned - remove the origin label from the error
  -h, --help - Display the help message for this command

Signatures:

  <nothing> | error make[ <record>] -> <any>

Parameters:

  error_struct: <record> The error to create.


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
            # optional
            span: {
                # if $.label.span exists, both start and end must be present
                start: 123
                end: 456
            }
        }
        help: "A help string, suggesting a fix to the user"  # optional
    }


  Create a custom error for a custom command that shows the span of the argument
  > def foo [x] {
        error make {
            msg: "this is fishy"
            label: {
                text: "fish right here"
                span: (metadata $x).span
            }
        }
    }
```
# Tests + Formatting
Added 1 test
2024-07-05 07:17:07 -05:00
..
overlay Make get_full_help take &dyn Command (#12903) 2024-05-19 19:56:33 +02:00
scope Define keywords (#13213) 2024-06-25 18:32:54 -07:00
alias.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
break_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
collect.rs Use pipeline data for http post|put|patch|delete commands. (#13254) 2024-07-01 12:34:19 -07:00
const_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
continue_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
def.rs Fix multiple issues with def --wrapped help example (#13123) 2024-06-10 19:12:54 -05:00
describe.rs Add string/binary type color to ByteStream (#12897) 2024-05-20 00:35:32 +00:00
do_.rs Fix do signature (#13216) 2024-06-29 16:17:06 -05:00
echo.rs Mention print in the echo help text (#12436) 2024-04-06 20:24:00 -05:00
error_make.rs don't show result in error make examples (#13296) 2024-07-05 07:17:07 -05:00
export_alias.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export_const.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export_def.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export_extern.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export_module.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export_use.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
export.rs Make get_full_help take &dyn Command (#12903) 2024-05-19 19:56:33 +02:00
extern_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
for_.rs for - remove deprecated --numbered (#13239) 2024-07-03 07:55:41 -05:00
hide_env.rs nu-cmd-lang cleanup (#12609) 2024-04-25 14:16:12 +00:00
hide.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
if_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
ignore.rs Rename IoStream to OutDest (#12433) 2024-04-09 16:48:32 +00:00
let_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
loop_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
match_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
mod.rs Remove lazy records (#12682) 2024-05-03 08:36:10 +08:00
module.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
mut_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
return_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
try_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00
use_.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
version.rs Allow plugins to report their own version and store it in the registry (#12883) 2024-06-21 06:27:09 -05:00
while_.rs Define keywords (#13213) 2024-06-25 18:32:54 -07:00