-
Notifications
You must be signed in to change notification settings - Fork 102
Adding conditional steps to config prompt #454
Adding conditional steps to config prompt #454
Conversation
Signed-off-by: Henrique Moraes <henrique.moraes@zup.com.br> Adding conditional steps to config prompt
170f69f
to
43c7f5e
Compare
Codecov Report
@@ Coverage Diff @@
## master #454 +/- ##
==========================================
+ Coverage 66.75% 67.20% +0.45%
==========================================
Files 80 80
Lines 2755 2784 +29
==========================================
+ Hits 1839 1871 +32
+ Misses 735 733 -2
+ Partials 181 180 -1
Continue to review full report at Codecov.
|
…nditional-variables Merge
Signed-off-by: Henrique Moraes <henrique.moraes@zup.com.br>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job 🥇
Signed-off-by: Henrique Moraes <henrique.moraes@zup.com.br>
Signed-off-by: Henrique Moraes <henrique.moraes@zup.com.br>
Amazing job indeed 👏 One further improvement suggestion: we could implement a parser to get rid of the
This implementation of yours is great already, though. Thanks! |
/merge qa |
👌 Merged branch feature/conditional-variables into qa |
Actually the parser is a good idea, it would allow us to cover the point above on multi-variables as well. We can leave as an improvement =] Hashicorp's bparser could take us a long way
|
Description
As requested on issue #390, this PR allows the developer to specify optional inputs according to previous user inputs. The user needs to create a key called
condition
on an optional step and provide a variable reference from any previous variable defined, an operator for comparison (==, !=, >, >=, <, <=), and a value to compare. If the condition exists and fails, the current step is not shown.This is a simple implementation some of the points taken in account are explained below:
case
like manner. It is not very elegant. The better approach would be to evaluate the expression, but it was not chosen because:eval
function and it would require to add a dependency to the project for a simple taskeval
command or letting the author add malicious code on theoperator
variableSuggestions are welcome!
How to verify it
Create a condition key on
config.json
of a formula like on this exampleRun the formula and fail the condition to have this prompt not shown
Description for the changelog
Adding conditional steps to config prompt