Skip to content

Commit

Permalink
Add terse documentation for each new added setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Feb 25, 2019
1 parent 1bfc2ee commit 2ecab5e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ This project honours [Semantic Versioning](http://semver.org/).
[Staged]
------------------------------------------------------------------------
* __Added:__ Ability to extract option-lists from strings
* __Added:__ Setting to [disable mixed-order][6] option/argument lists
* __Added:__ Setting to [throw an error][7] for unrecognised options
* __Added:__ Support for [terminating][8] options using a double-dash
* __Fixed:__ Options array being modified by reference

[6]: ./docs/advanced-settings.md#nomixedorder
[7]: ./docs/advanced-settings.md#noundefined
[8]: ./docs/advanced-settings.md#terminator


[v1.1.3]
------------------------------------------------------------------------
Expand Down
33 changes: 32 additions & 1 deletion docs/advanced-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ The supported settings and their default values are:
<a href="#ignoreequals">ignoreEquals</a>: false,
<a href="#noaliaspropagation">noAliasPropagation</a>: false,
<a href="#nobundling">noBundling</a>: false,
<a href="#nocamelcase">noCamelCase</a>: false
<a href="#nocamelcase">noCamelCase</a>: false,
<a href="#nomixedorder">noMixedOrder</a>: false,
<a href="#noundefined">noUndefined</a>: false,
<a href="#terminator">terminator</a>: null,
});</code></pre>


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

$ program --set-size
-> options["set-size"]



noMixedOrder
------------

Terminate option-processing at the first non-option:

$ program --global outdated # This would work
$ program outdated --global # This would not

Normally, the whole argument list is traversed and filtered free of recognised option declarations.
If you're building complex subcommands with their own option-lists, you'll want `noMixedOrder` enabled. Seriously.



noUndefined
-----------

Throw a [`TypeError`](https://mdn.io/TypeError) if an unrecognised option is passed whilst still parsing options.

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.


terminator
----------

A string (conventionally a double-dash) signifying that option parsing is to stop and all remaining elements should be treated verbatim.

0 comments on commit 2ecab5e

Please sign in to comment.