mirror of
https://github.com/nushell/nushell.git
synced 2025-05-10 04:54:28 +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> |
||
---|---|---|
.. | ||
mod.rs | ||
test_bits.rs | ||
test_cell_path.rs | ||
test_commandline.rs | ||
test_conditionals.rs | ||
test_config_path.rs | ||
test_config.rs | ||
test_converters.rs | ||
test_custom_commands.rs | ||
test_engine.rs | ||
test_env.rs | ||
test_help.rs | ||
test_hiding.rs | ||
test_ide.rs | ||
test_iteration.rs | ||
test_known_external.rs | ||
test_math.rs | ||
test_modules.rs | ||
test_parser.rs | ||
test_ranges.rs | ||
test_regex.rs | ||
test_signatures.rs | ||
test_spread.rs | ||
test_stdlib.rs | ||
test_strings.rs | ||
test_table_operations.rs | ||
test_type_check.rs | ||
tests.rs |