nushell/crates/nu-parser/src
Leonhard Kipp 71b99edd48
parser/add rest args to def (#2961)
* Add rest arg to def

This commit applied adds the ability to define the rest parameter of a def
command. It does not implement the functionality to expand the rest argument in
a user defined def function.

The rest argument has to be exactly worded "...rest".

Example after this PR is applied:

file test.nu
```shell
def my_command [
    ...rest:int # My rest arg
] {
    echo 1 2 3
}
```

```shell
> source test.nu
> my_command -h
Usage:
  > my_command ...args {flags}

Parameters:
  ...args: My rest arg

Flags:
  -h, --help: Display this help message
```

* Fix space in help on wrong side
2021-01-23 07:13:29 +13:00
..
parse parser/add rest args to def (#2961) 2021-01-23 07:13:29 +13:00
errors.rs Getting ready for multiline scripts (#2737) 2020-11-10 05:27:07 +13:00
lex.rs parser/split long short flags (#2944) 2021-01-20 07:19:53 +13:00
lib.rs Feature/def signature with comments (#2905) 2021-01-12 06:53:58 +13:00
parse.rs Fix bug #2921 (#2945) 2021-01-21 07:58:37 +13:00
path.rs Support completion for paths with multiple dots (#1640) 2020-04-23 16:17:38 +12:00
scope.rs Multiline scripts part 2 (#2795) 2020-12-18 20:53:49 +13:00
shapes.rs Multiline scripts part 2 (#2795) 2020-12-18 20:53:49 +13:00
signature.rs Pipeline blocks (#1579) 2020-04-13 19:59:57 +12:00