nushell/tests
Bahex 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
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ feat(overlay): expose constants with overlay use (#15081) 2025-02-13 18:55:03 +08:00
eval Fix to nuon --serialize of closure (#15357) 2025-03-20 17:50:36 +01:00
fixtures fix(lsp): regression of semantic tokens of module-prefixed commands (#15603) 2025-04-19 06:02:49 -05:00
hooks Make Hooks fields non-optional to match the new config defaults (#14345) 2024-11-29 21:11:09 +00:00
modules don't include import path in args to aliased external commands (#14231) 2024-11-06 07:40:29 -06:00
overlays overlay use: keep PWD after activating the overlay thought file. (#15566) 2025-04-21 20:09:08 +08:00
parsing Bugfix/loss of precision when parsing value with unit (#15606) 2025-04-19 17:02:40 -05:00
path Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
plugin_persistence Make plugin list read state from plugin registry file as well (#14085) 2024-10-20 23:12:57 +02:00
plugins Fix unstable test case: One time my windows report drive letter as lowercase (#14451) 2024-11-27 06:27:06 -06:00
repl Add SyntaxShape::OneOf syntax users can use (#15646) 2025-05-07 15:43:01 -05:00
scope Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
shell IR: rasing reasonable error when using subexpression with and operator (#15623) 2025-04-25 22:00:20 +08:00
main.rs Merged tests to produce a single binary (#12826) 2024-05-13 13:37:53 +00:00