vercel / arg

Simple argument parsing
https://npmjs.com/arg
MIT License
1.23k stars 54 forks source link

Support parsing `--` into a separate result key #33

Closed blakeembrey closed 5 years ago

blakeembrey commented 5 years ago

Closes https://github.com/zeit/arg/issues/30. I needed to re-use the same logic of type and array handling between the -- function and regular functions so I created the arg.of wrapper that'll automatically be used when the arg is of [Handler] type.

This feature allows someone to split -- args apart from _ by defining -- in the opts object. All changes are backward compatible with existing code and these changes do not affect the type signature since { '--': [String] } "just works" with the current TypeScript definition.