mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 17:30:45 +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> |
||
---|---|---|
.. | ||
ast | ||
config | ||
debugger | ||
engine | ||
errors | ||
ir | ||
pipeline | ||
plugin | ||
process | ||
value | ||
alias.rs | ||
did_you_mean.rs | ||
eval_base.rs | ||
eval_const.rs | ||
example.rs | ||
id.rs | ||
lev_distance.rs | ||
lib.rs | ||
module.rs | ||
parser_path.rs | ||
signature.rs | ||
span.rs | ||
syntax_shape.rs | ||
ty.rs |