mirror of
https://github.com/nushell/nushell.git
synced 2025-05-10 21:14:26 +02:00
# 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> |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml | ||
LICENSE | ||
README.md |
nu-protocol
The nu-protocol crate holds the definitions of structs/traits that are used throughout Nushell. This gives us one way to expose them to many other crates, as well as make these definitions available to each other, without causing mutually recursive dependencies.