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

conditional dependsOn #323

Closed
cyrfer opened this issue Feb 2, 2020 · 1 comment · Fixed by oclif/core#468
Closed

conditional dependsOn #323

cyrfer opened this issue Feb 2, 2020 · 1 comment · Fixed by oclif/core#468
Labels
enhancement New feature or request

Comments

@cyrfer
Copy link

cyrfer commented Feb 2, 2020

Do you want to request a feature or report a bug?

feature

What is the current behavior?

only statically defined dependencies are supported

What is the expected behavior?

Developers need to be able to define a function that has rules about when other fields are required.

For example, if making a HTTP client like curl, you would define flags for 'method' and 'data' (body). The data field is required ONLY WHEN method=POST.

I propose the "dependsOn" flag property be an object rather than an array, where the keys are the names of other fields required, and the values are true or a async function that is passed the complete command context and must return a bool.

Please mention your oclif and OS version.

@oclif/command": "^1.5.19

@RasPhilCo RasPhilCo added the enhancement New feature or request label Dec 19, 2020
@jonaslagoni
Copy link

I just encountered the same kind of use case, would love to see this feature.

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

Successfully merging a pull request may close this issue.

3 participants