c2ac8f730e
Rust 1.85, edition=2024 ( #15741 )
2025-05-13 16:49:30 +02:00
a0d7c1a4fd
Add SyntaxShape::OneOf
syntax users can use ( #15646 )
...
# Description
Built-in commands can have parameter of `SyntaxShape::OneOf`.
This PR changes `OneOf`'s string representation and gives users the
ability to use it in definitions.
> _Syntax updated after discussion on discord._
```nushell
def foo [
param: oneof<binary, string>
] { .. }
```
```
Usage:
> foo <param>
Flags:
-h, --help: Display the help message for this command
Parameters:
param <oneof<binary, string>>
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
```
<details><summary>Previous iterations</summary>
<p>
> ```nushell
> def foo [
> param: (binary | string)
> ] { .. }
> ```
> ---
>
> ```nushell
> def foo [
> param: one_of(binary, string)
> ] { .. }
> ```
</p>
</details>
# User-Facing Changes
# Tests + Formatting
Added some test cases.
- 🟢 toolkit fmt
- 🟢 toolkit clippy
- 🟢 toolkit test
- 🟢 toolkit test stdlib
# After Submitting
- Update the website to include the new syntax
[here](https://github.com/nushell/nushell.github.io/blob/main/book/custom_commands.md )
- Update [tree-sitter-nu](https://github.com/nushell/tree-sitter-nu )
- Update `std` and `std-rfc` where applicable
---------
Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com >
2025-05-07 15:43:01 -05:00
23fba6d2ea
correctly parse table literals as lists ( #14226 )
...
# User-Facing Changes
Table literal arguments to list parameters are now correctly parsed:
```diff
def a [l: list<any>] { $l | to nuon }; a [[a]; [2]]
-[[a]]
+[[a]; [2]]
```
2024-11-06 07:36:56 -06:00
3f75b6b371
error when closure param lists aren't terminated by |
( #14095 )
...
Fixes #13757 , fixes #9562
# User-Facing Changes
- `unclosed |` is returned for malformed closure parameters:
```
{ |a }
```
- Parameter list closing pipes are highlighted as part of the closure
2024-10-22 10:40:45 -05:00
c4dca5fe03
Merged tests to produce a single binary ( #12826 )
...
This PR should close #7147
# Description
Merged src/tests into /tests to produce a single binary.

# User-Facing Changes
No user facing changes
# Tests + Formatting
Moved tests. Tollkit check pr pass.
# After Submitting
---------
Co-authored-by: Ian Manske <ian.manske@pm.me >
2024-05-13 13:37:53 +00:00