mirror of
https://github.com/nushell/nushell
synced 2024-12-29 06:23:11 +00:00
d0a2a02eea
* Add possibility to declare optional parameters and switch flags With this commit applied it is now possible to specify optional parameters and flags as switches. This PR **only** makes guarantees about **parsing** optional flags and switches correctly. This PR **does not guarantee flawless functionality** of optional parameters / switches within scripts. functionality within scripts. Example: test.nu ```shell def my_command [ opt_param? opt_param2?: int --switch ] {echo hi nushell} ``` ```shell > source test.nu > my_command -h ───┬───────── 0 │ hi 1 │ nushell ───┴───────── Usage: > my_command <mandatory_param> (opt_param) (opt_param2) {flags} Parameters: <mandatory_param> (opt_param) (opt_param2) Flags: -h, --help: Display this help message --switch --opt_flag <any> ``` * Update def docs |
||
---|---|---|
.. | ||
commands | ||
sample_config | ||
sample_plugins/powershell | ||
docker.md | ||
philosophy.md |