nomnom icon indicating copy to clipboard operation
nomnom copied to clipboard

using `default: true` together with `flag: true` effectively disables the option and always produces TRUE.

Open GerHobbelt opened this issue 10 years ago • 1 comments

nomnom does not cope well with 'flag' options which are set to true by default: there's no way to set these to false instead.

Example option:

    var opts = require('nomnom')
        .options({
            debug: {
                abbr: 't',
                flag: true,
                default: true,    // <-- !!! you **always** get opts.debug === true now
                help: 'Debug mode'
            },
            //...
        }).parse();

In other words: there's no -t- (note trailing minus) or similar way to say on the commandline: set flag option to FALSE (rather than TRUE).

Other systems sometimes support -\<flag_option>+ and -\<flag_option>- i.e. trailing + or - to force a TRUE or FALSE value for flag options.

GerHobbelt avatar Jun 09 '15 10:06 GerHobbelt

Notes: the long-name phrasing of an option, e.g. --debug, already has this ability by prefixing it with no-: --no-debug.

GerHobbelt avatar Jun 09 '15 12:06 GerHobbelt