Merge pull request #63 from lydell/dash-dash-docs-fix
move the `opts['--']` example back where it belongs
This commit is contained in:
Коммит
4cf45a26b9
|
@ -65,19 +65,20 @@ argument names to use as aliases
|
||||||
first non-option
|
first non-option
|
||||||
* `opts['--']` - when true, populate `argv._` with everything before the `--`
|
* `opts['--']` - when true, populate `argv._` with everything before the `--`
|
||||||
and `argv['--']` with everything after the `--`. Here's an example:
|
and `argv['--']` with everything after the `--`. Here's an example:
|
||||||
|
|
||||||
|
```
|
||||||
|
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
|
||||||
|
{ _: [ 'one', 'two', 'three' ],
|
||||||
|
'--': [ 'four', 'five', '--six' ] }
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that with `opts['--']` set, parsing for arguments still stops after the
|
||||||
|
`--`.
|
||||||
|
|
||||||
* `opts.unknown` - a function which is invoked with a command line parameter not
|
* `opts.unknown` - a function which is invoked with a command line parameter not
|
||||||
defined in the `opts` configuration object. If the function returns `false`, the
|
defined in the `opts` configuration object. If the function returns `false`, the
|
||||||
unknown option is not added to `argv`.
|
unknown option is not added to `argv`.
|
||||||
|
|
||||||
```
|
|
||||||
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
|
|
||||||
{ _: [ 'one', 'two', 'three' ],
|
|
||||||
'--': [ 'four', 'five', '--six' ] }
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that with `opts['--']` set, parsing for arguments still stops after the
|
|
||||||
`--`.
|
|
||||||
|
|
||||||
# install
|
# install
|
||||||
|
|
||||||
With [npm](https://npmjs.org) do:
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче