fix(node-plop): bypass list prompts with choices being a function #372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #224
While #224 is closed with a workaround, that workaround does not work for me as I rely on a series of
list
prompts where the available choices depends on previously selected values.This PR provides a simple fix for handling the
list
prompt when thechoices
property is a function. We pass the previous answers into bypass function, and inlistTypeBypass
we check ifchoices
is a function and in that case invokes it to get the available choices as an arrayI suppose this can be extended to support checkboxes as well, but that goes beyond my immediate need.