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: parser doesn't validate against options parameter if the value is provided through an env var #474

Merged
merged 1 commit into from Aug 16, 2022

Conversation

rafaelmotaalves
Copy link
Contributor

Hey, I found this issue that when I try to pass a flag as an environment variable it is not validated if this value is on the options field.

An example would be

export default class MyCommand extends Command {
  static flags = {
    foo: Flags.string({
      env: 'FOO',
      options: ['valid1', 'valid2']
    })
  }
}

My understanding here is that if I execute the command with the FOO environment variable as invalid the parsing should fail and an error message should be displayed, this is not happening.

I added a couple of tests that verify this behavior and fixed it on this PR.

@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @rafaelmotaalves to sign the Salesforce.com Contributor License Agreement.

@mdonnalley mdonnalley merged commit fe6dfea into oclif:main Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants