Skip to content

[QUESTION] Handling default values? #64

@robations

Description

@robations

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Questionfurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions