You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor!: restructure configuration to take options bag (#63)
Per the discussion in #45 this PR restructures the current options API where each option is configured in three separate list and instead allows options to be configured in a single object.
The goal being to make the API more intuitive for configuring options (e.g. short, withValue, and multiples) while creating a path forward for introducing more configuration options in the future (e.g. default).
Co-authored-by: Benjamin E. Coe <[email protected]>
Co-authored-by: John Gee <[email protected]>
Co-authored-by: Jordan Harband <[email protected]>
*`argv` {string[]} (Optional) Array of argument strings; defaults
80
-
to [`process.mainArgs`](process_argv)
81
-
*`options` {Object} (Optional) The `options` parameter is an
79
+
*`config` {Object} (Optional) The `config` parameter is an
82
80
object supporting the following properties:
83
-
*`withValue` {string[]} (Optional) An `Array` of argument
84
-
strings which expect a value to be defined in `argv` (see [Options][]
85
-
for details)
86
-
*`multiples` {string[]} (Optional) An `Array` of argument
87
-
strings which, when appearing multiple times in `argv`, will be concatenated
88
-
into an `Array`
89
-
*`short` {Object} (Optional) An `Object` of key, value pairs of strings which map a "short" alias to an argument; When appearing multiples times in `argv`; Respects `withValue` & `multiples`
81
+
*`args` {string[]} (Optional) Array of argument strings; defaults
82
+
to [`process.mainArgs`](process_argv)
83
+
*`options` {Object} (Optional) An object describing the known options to look for in `args`; `options` keys are the long names of the known options, and the values are objects with the following properties:
84
+
*`type` {'string'|'boolean'} (Optional) Type of known option; defaults to `'boolean'`;
85
+
*`multiple` {boolean} (Optional) If true, when appearing one or more times in `args`, results are collected in an `Array`
86
+
*`short` {string} (Optional) A single character alias for an option; When appearing one or more times in `args`; Respects the `multiple` configuration
90
87
*`strict` {Boolean} (Optional) A `Boolean` on wheather or not to throw an error when unknown args are encountered
91
88
* Returns: {Object} An object having properties:
92
89
*`flags` {Object}, having properties and `Boolean` values corresponding to parsed options passed
0 commit comments