Skip to content

Commit 2ecab5e

Browse files
committed
Add terse documentation for each new added setting
1 parent 1bfc2ee commit 2ecab5e

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ This project honours [Semantic Versioning](http://semver.org/).
1010
[Staged]
1111
------------------------------------------------------------------------
1212
* __Added:__ Ability to extract option-lists from strings
13+
* __Added:__ Setting to [disable mixed-order][6] option/argument lists
14+
* __Added:__ Setting to [throw an error][7] for unrecognised options
15+
* __Added:__ Support for [terminating][8] options using a double-dash
1316
* __Fixed:__ Options array being modified by reference
1417

18+
[6]: ./docs/advanced-settings.md#nomixedorder
19+
[7]: ./docs/advanced-settings.md#noundefined
20+
[8]: ./docs/advanced-settings.md#terminator
21+
1522

1623
[v1.1.3]
1724
------------------------------------------------------------------------

docs/advanced-settings.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ The supported settings and their default values are:
1111
<a href="#ignoreequals">ignoreEquals</a>: false,
1212
<a href="#noaliaspropagation">noAliasPropagation</a>: false,
1313
<a href="#nobundling">noBundling</a>: false,
14-
<a href="#nocamelcase">noCamelCase</a>: false
14+
<a href="#nocamelcase">noCamelCase</a>: false,
15+
<a href="#nomixedorder">noMixedOrder</a>: false,
16+
<a href="#noundefined">noUndefined</a>: false,
17+
<a href="#terminator">terminator</a>: null,
1518
});</code></pre>
1619

1720

@@ -196,3 +199,31 @@ If you prefer to keep names verbatim, just set `noCamelCase` to any truthy value
196199

197200
$ program --set-size
198201
-> options["set-size"]
202+
203+
204+
205+
noMixedOrder
206+
------------
207+
208+
Terminate option-processing at the first non-option:
209+
210+
$ program --global outdated # This would work
211+
$ program outdated --global # This would not
212+
213+
Normally, the whole argument list is traversed and filtered free of recognised option declarations.
214+
If you're building complex subcommands with their own option-lists, you'll want `noMixedOrder` enabled. Seriously.
215+
216+
217+
218+
noUndefined
219+
-----------
220+
221+
Throw a [`TypeError`](https://mdn.io/TypeError) if an unrecognised option is passed whilst still parsing options.
222+
223+
Custom error messages may be specified to replace the default `Unknown option: "%s"`. If that isn't enough, you can also supply a callback to return something more specific to throw at the user.
224+
225+
226+
terminator
227+
----------
228+
229+
A string (conventionally a double-dash) signifying that option parsing is to stop and all remaining elements should be treated verbatim.

0 commit comments

Comments
 (0)