Skip to content

Commit 7a586c7

Browse files
authored
Update custom_commands.md (#1869)
1 parent 3d17493 commit 7a586c7

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

book/custom_commands.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,11 @@ greet Wei Mei
343343
greet Wei
344344
# => Error: nu::parser::missing_positional
345345
# =>
346-
# =>
347-
# => × Missing required positional argument.
348-
# => ╭─[entry #10:1:10]
349-
# => 1 │ greet Mei
350-
# => ╰────
351-
# => help: Usage: greet <name1> <name2> . Use `--help` for more information.
346+
# => × Missing required positional argument.
347+
# => ╭─[entry #1:1:10]
348+
# => 1 │ greet Wei
349+
# => ╰────
350+
# => help: Usage: greet <name1> <name2> . Use `--help` for more information.
352351
```
353352

354353
::: tip
@@ -365,7 +364,6 @@ def greet [name?: string] {
365364
}
366365
367366
greet
368-
369367
# => Hello, You
370368
```
371369

@@ -386,7 +384,6 @@ def greet [name?: string] {
386384
}
387385
388386
greet
389-
390387
# => Hello! I don't know your name!
391388
```
392389

@@ -445,11 +442,14 @@ greet World
445442
If we try to run the above, Nushell will tell us that the types don't match:
446443

447444
```nu
448-
error: Type Error
449-
┌─ shell:6:7
450-
451-
5 │ greet world
452-
│ ^^^^^ Expected int
445+
Error: nu::parser::parse_mismatch
446+
447+
× Parse mismatch during operation.
448+
╭─[entry #1:1:7]
449+
1 │ greet World
450+
· ──┬──
451+
· ╰── expected int
452+
╰────
453453
```
454454

455455
::: tip Cool!
@@ -783,21 +783,21 @@ Input-Output signatures allow Nushell to catch two additional categories of erro
783783
- Attempting to return the wrong type from a command. For example:
784784

785785
```nu
786-
def inc []: int -> int {
786+
def inc []: int -> int {
787787
$in + 1
788788
print "Did it!"
789789
}
790790
791791
# => Error: nu::parser::output_type_mismatch
792792
# =>
793-
# => × Command output doesn't match int.
794-
# => ╭─[entry #12:1:24]
795-
# => 1 │ ╭─▶ def inc []: int -> int {
796-
# => 2 │ │ $in + 1
797-
# => 3 │ │ print "Did it!"
798-
# => 4 │ ├─▶ }
799-
# => · ╰──── expected int, but command outputs nothing
800-
# => ╰────
793+
# => × Command output doesn't match int.
794+
# => ╭─[entry #1:1:24]
795+
# => 1 │ ╭─▶ def inc []: int -> int {
796+
# => 2 │ │ $in + 1
797+
# => 3 │ │ print "Did it!"
798+
# => 4 │ ├─▶ }
799+
# => · ╰──── expected int, but command outputs nothing
800+
# => ╰────
801801
```
802802

803803
- And attempting to pass an invalid type into a command:
@@ -807,12 +807,12 @@ Input-Output signatures allow Nushell to catch two additional categories of erro
807807
"Hi" | inc
808808
# => Error: nu::parser::input_type_mismatch
809809
# =>
810-
# => × Command does not support string input.
811-
# => ╭─[entry #16:1:8]
812-
# => 1 │ "Hi" | inc
813-
# => · ─┬─
814-
# => · ╰── command doesn't support string input
815-
# => ╰────
810+
# => × Command does not support string input.
811+
# => ╭─[entry #1:1:8]
812+
# => 1 │ "Hi" | inc
813+
# => · ─┬─
814+
# => · ╰── command doesn't support string input
815+
# => ╰────
816816
```
817817

818818
:::

0 commit comments

Comments
 (0)