mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 18:30:07 +00:00
updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ca1b18e462
commit
6c1dba900f
27
README.md
27
README.md
@ -60,6 +60,7 @@ This code is an evolution of that parser.
|
||||
- [`<option>.priority`](#optionpriority)
|
||||
- [`<option>.arg`](#optionarg)
|
||||
- [`<option>.type`](#optiontype)
|
||||
- [`<option>.collect`](#optioncollect)
|
||||
- [`<option>.env`](#optionenv)
|
||||
- [`<option>.default`](#optiondefault)
|
||||
- [`<option>.required`](#optionrequired)
|
||||
@ -373,11 +374,35 @@ Supported types:
|
||||
- `"float"`
|
||||
- `"number"`
|
||||
- `"string"`
|
||||
- `"date"`
|
||||
- `"date"` – expects a `new Date(..)` compatible date string
|
||||
- `"list"` – value is split by `","` and written as an `Array` object
|
||||
|
||||
Type handlers are defined in `Parser.typeHandlers` or can be overwritten
|
||||
by `<spec>.typeHandlers`.
|
||||
|
||||
If not set values are written as strings.
|
||||
|
||||
|
||||
#### `<option>.collect`
|
||||
|
||||
Option value collection mode.
|
||||
|
||||
The given handler will be used to _collect_ values passed to multiple
|
||||
occurences of the option and write the result to `<key>`.
|
||||
|
||||
Supported collection modes:
|
||||
- `"list"` – group values into an `Array` object
|
||||
- `"set"` – group values into a `Set` object
|
||||
- `"string"` – concatinate values into a string
|
||||
|
||||
Type handlers are defined in `Parser.valueCollectors` or can be overwritten
|
||||
by `<spec>.valueCollectors`.
|
||||
|
||||
`<option>.collect` can be used in conjunction with `<option>.type` to both
|
||||
convert and collect values.
|
||||
|
||||
If not set, each subsequent option repetition will overwrite the value.
|
||||
|
||||
|
||||
#### `<option>.env`
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user