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
{{ message }}
Repository navigation
[FEATURE] Add a handler for *unknown* options, analogous to invalidHandler #41
Currently (v3.0.1), nopt invariably accepts unknown options and simply adds them to the object returned.
However, a typical use case for a CLI is to abort processing in case an unknown option is specified.
Thus, an .unknownHandler property specifying a function to call on encountering an unknown option would be handy - analogous to the existing .invalidHandler property for handling invalid option values.
changed the title [-]Suggestion: add a handler for *unknown* options, analogous to `invalidHandler`[/-][+][FEATURE] Add a handler for *unknown* options, analogous to `invalidHandler`[/+]on Jul 28, 2022
Activity
binki commentedon May 30, 2017
IMO, default behavior should be to throw and an
.unknownHandlershould be used to either change the behavior or print out a prettier message.[-]Suggestion: add a handler for *unknown* options, analogous to `invalidHandler`[/-][+][FEATURE] Add a handler for *unknown* options, analogous to `invalidHandler`[/+]wraithgar commentedon Jan 8, 2025
#180
wraithgar commentedon Jan 21, 2025
This is now included in
[email protected]