Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

How to demand an argument value instead of it defaulting to true? #44

Closed
clintharris opened this Issue · 0 comments

2 participants

@clintharris

Given the following:

var argv = optimist.usage('Usage: $0 --config <path>', {
    'config': {
        description: "Path to config file",
        demand: 'true',
        string: true
    }
}).argv;

I was hoping the following usage would not be accepted:

node myapp.js --config

In other words, I consider --config path/to/file to be valid usage but --config invalid. Instead, "validation" passes and optimist sets argv.config to have value true.

Is there some way I can configure optimist to not accept "empty" arguments like this?

Thanks!

@substack substack closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.