Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix flag.default values validation #238

Merged

Conversation

istandre
Copy link
Contributor

@istandre istandre commented May 3, 2023

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 sindresorhus merged commit c3bf62b into sindresorhus:main May 4, 2023
@sindresorhus
Copy link
Owner

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flag.default values validation is faulty
2 participants