From d3762f4f9c7433acef251d1ab09630f941272ad5 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 27 Jul 2020 19:02:43 +0300 Subject: [PATCH] reworked type handlers and value collectors + docs... Signed-off-by: Alex A. Naanou --- README.md | 14 ++--- argv.js | 148 +++++++++++++++++++++++++++++++-------------------- package.json | 2 +- test.js | 6 +++ 4 files changed, 104 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index f40a211..f259dbb 100644 --- a/README.md +++ b/README.md @@ -398,8 +398,13 @@ occurrences of the option and write the result to ``. Supported collection modes: - `"list"` – group values into an `Array` object - `"set"` – group values into a `Set` object -- `"string"` – concatenate values into a string -- `"toggle"` – toggle option value (bool) +- `"string"` – concatenate values into a string. + This also supports an optional separator, for example `"string|\t"` will + collect values into a string joining them with a tab (i.e. `"\t"`). + Default separator is: `" "` +- `"toggle"` – toggle option value (bool). + Note that the actual value assigned to an option is ignored here and can + be omitted. Type handlers are defined in `Parser.valueCollectors` or can be overwritten by `.valueCollectors`. @@ -407,10 +412,7 @@ by `.valueCollectors`. `