forked from extern/nushell
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 |
||
---|---|---|
.. | ||
nu_plugin_binaryview | ||
nu_plugin_chart | ||
nu_plugin_fetch | ||
nu_plugin_from_bson | ||
nu_plugin_from_sqlite | ||
nu_plugin_inc | ||
nu_plugin_match | ||
nu_plugin_post | ||
nu_plugin_ps | ||
nu_plugin_s3 | ||
nu_plugin_selector | ||
nu_plugin_start | ||
nu_plugin_sys | ||
nu_plugin_textview | ||
nu_plugin_to_bson | ||
nu_plugin_to_sqlite | ||
nu_plugin_tree | ||
nu_plugin_xpath | ||
nu-cli | ||
nu-command | ||
nu-data | ||
nu-engine | ||
nu-errors | ||
nu-json | ||
nu-parser | ||
nu-plugin | ||
nu-protocol | ||
nu-source | ||
nu-stream | ||
nu-table | ||
nu-test-support | ||
nu-value-ext |