sindresorhus / meow

🐈 CLI app helper
MIT License
3.53k stars 150 forks source link

Fix flag.default values validation #238

Closed istandre closed 1 year ago

istandre commented 1 year ago

Fixes #239 This fixes the validation of the default values.

Example:

meow({
    importMeta,
    flags: {
        string: {
            type: 'string',
            choices: ['dog', 'cat', 'unicorn'],
            default: 'unicorn',
        },
    },
});

should not throw an error, since 'unicorn' exists within the option choices.

But instead, it throws the following error:

Each value of the option `default` must exist within the option `choices`. Invalid flags: `--string`.
sindresorhus commented 1 year ago

Thanks :)