nushell/crates
Leonhard Kipp d0a2a02eea
Add possibility to declare optional parameters and switch flags (#2966)
* 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
2021-01-28 06:31:29 +13:00
..
nu_plugin_binaryview Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_chart Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_fetch Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_from_bson Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_from_sqlite Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_inc Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_match Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_post Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_ps Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_s3 Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_selector Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_start Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_sys Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_textview Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_to_bson Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_to_sqlite Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_tree Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu_plugin_xpath Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-cli Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-command Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-data add % operator for modulus, work with decimals (#2975) 2021-01-26 12:42:34 -06:00
nu-engine Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-errors Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-json Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-parser Add possibility to declare optional parameters and switch flags (#2966) 2021-01-28 06:31:29 +13:00
nu-plugin Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-protocol Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-source Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-stream Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-table Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-test-support Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
nu-value-ext Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00