Skip to content
New issue

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

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

Already on GitHub? # to your account

[QUESTION] Handling default values? #64

Open
robations opened this issue Jun 4, 2016 · 0 comments
Open

[QUESTION] Handling default values? #64

robations opened this issue Jun 4, 2016 · 0 comments
Labels
Question further information is requested

Comments

@robations
Copy link

I'm wondering what is the expected way to handle arguments or options that are not supplied.

To give one example, I have an option which should be true by default:

const knownOpts = {headers: [Boolean]};

And this would be commonly used in the cmd line as --no-headers. In the current scheme I will either have:

parsed.headers = undefined // falsy, but want it to be true
or
parsed.headers = false // definitely falsy

At the moment it feels like nopt creates an incomplete model of my options and I then have to pass to another function to normalise all incomplete values. Perhaps this is either a feature request or out of scope.

@darcyclarke darcyclarke changed the title Handling default values? [Question] Handling default values? Jul 28, 2022
@darcyclarke darcyclarke changed the title [Question] Handling default values? [QUESTION] Handling default values? Jul 28, 2022
@darcyclarke darcyclarke added the Question further information is requested label Jul 28, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Question further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants