Skip to content

Commit f669a1a

Browse files
Document match rest args
1 parent 4c13465 commit f669a1a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

blog/2024-11-12-nushell_0_100_0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,4 @@ Thanks to all the contributors below for helping us solve issues and improve doc
120120
./make_release/release-note/get-full-changelog
121121
```
122122
here
123-
-->
123+
-->

commands/docs/match.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ Match against a list
5656
6
5757
```
5858

59+
Match against a list with rest pattern
60+
```nu
61+
> match [1, 2, 3] { [$a, ..$rest] => { $rest } }
62+
╭───┬───╮
63+
│ 0 │ 2 │
64+
│ 1 │ 3 │
65+
╰───┴───╯
66+
```
67+
5968
Match against pipeline input
6069
```nu
6170
> {a: {b: 3}} | match $in {{a: { $b }} => ($b + 10) }
@@ -74,4 +83,4 @@ good list
7483

7584
## Notes
7685
This command is a parser keyword. For details, check:
77-
https://www.nushell.sh/book/thinking_in_nu.html
86+
https://www.nushell.sh/book/thinking_in_nu.html

0 commit comments

Comments
 (0)