Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add a handler for *unknown* options, analogous to invalidHandler #41

Open
mklement0 opened this issue Jan 30, 2015 · 2 comments
Labels
Enhancement new feature or improvement

Comments

@mklement0
Copy link
Contributor

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.

I'd be happy to implement this.

@ghost
Copy link

ghost commented Aug 25, 2015

This is exactly what I was just looking for.

@binki
Copy link

binki commented May 30, 2017

IMO, default behavior should be to throw and an .unknownHandler should be used to either change the behavior or print out a prettier message.

@darcyclarke darcyclarke changed the title Suggestion: add a handler for *unknown* options, analogous to invalidHandler [FEATURE] Add a handler for *unknown* options, analogous to invalidHandler Jul 28, 2022
@darcyclarke darcyclarke added the Enhancement new feature or improvement label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement new feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants