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

allow flags to have false value in when #557

Merged
merged 2 commits into from Dec 27, 2022

Conversation

MichaelGoberling
Copy link
Contributor

We have certain scenarios where we want to disallow users from using a --no flag when another flag is present. It seems we can do this by checking the value of the flag we want to disallow in when, but it ignores false values.

Flags

action: Flags.string({ 
    description: "Deploy a specific action", 
    exclusive: [{ name: 'actions', when: async (flags) => flags.actions === false }] 
}),
actions Flags.boolean({ 
    description: "Deploy actions", 
    allowNo: true 
})

Execution

bin/run app deploy --action=a --no-actions
<success>

With this PR, the above will throw an error.

The following error occurred:
  --actions=false cannot also be provided when using --action
See more help with --help

Related Issue

Closes #556

Currently a draft PR, because this was added without any tests failing and only one case has been added.

@salesforce-cla
Copy link

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Michael Goberling <m***@m***.local>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce.com Contributor License Agreement and this Pull Request will be revalidated.

@MichaelGoberling
Copy link
Contributor Author

MichaelGoberling commented Nov 17, 2022

After getting your commits associated with your GitHub account, sign the Salesforce.com Contributor License Agreement and this Pull Request will be revalidated.

Signed 👍

mdonnalley
mdonnalley previously approved these changes Nov 17, 2022
@MichaelGoberling
Copy link
Contributor Author

@mdonnalley Thanks for taking a look at this!

Added a new failure test case. CLA has been signed and the commits have been updated with a valid author 👍

@MichaelGoberling
Copy link
Contributor Author

@mdonnalley CLA has been signed. I may have confused the bot with the force push to fix the commit authors.

@cristiand391
Copy link
Member

hey @MichaelGoberling 👋🏼 ,is this ready for review? if so please update the PR as it is marked as draft and can't be merged.

@MichaelGoberling MichaelGoberling marked this pull request as ready for review December 12, 2022 15:56
@MichaelGoberling
Copy link
Contributor Author

Hey @cristiand391 👋 Yup! This is ready for review now.

@cristiand391 cristiand391 self-requested a review December 12, 2022 17:48
@cristiand391 cristiand391 merged commit c40ce71 into oclif:main Dec 27, 2022
@cristiand391
Copy link
Member

@oclif/core@1.23.0 was published with this fix, thanks @MichaelGoberling for contributing :)

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.

when does not support flags with false values
3 participants