Add comprehensive golden fixture tests for if feature:
- Command-level if (true/false)
- Task-level if (true/false)
- Task calls with if conditions
- Go template functions (eq, ne, and, or)
- Direct template variable evaluation
- CLI variable overrides
- For loops with if conditions
Add comprehensive test cases for:
- Task calls in cmds with if conditions
- Go template functions (eq, ne, and, or)
- Direct template variable evaluation
- CLI variable overrides
- Task-level if with templates
Add `if` field to tasks and commands that allows conditional execution
based on a shell command exit code. When the condition returns non-zero,
the task/command is silently skipped (with verbose logging).
- Task-level: skip entire task if condition fails
- Command-level: skip individual command if condition fails
- Supports template variables in conditions
- Works with for loops (condition evaluated per iteration)
- Works with deferred commands
Previously if a task was run as a dependency of another task,
the error message simply reported something like:
exit status 1
It is desirable instead to name the root task and all child tasks in the tree
to the failing task.
After this PR, the error message will read:
task: Failed to run task "root": task: Failed to run task "failing-task": exit status 1
* feat: use TaskTest for executor tests
* feat: more tests
* feat: separate tests for executing and formatting with new functional options that work for both test types
* feat: formatter tests
* refactor: more tests
* forward env to RunCommand when evaluating sh vars. fixes#1742
* feat: added tests
* fix: test
---------
Co-authored-by: Pete Davison <pd93.uk@outlook.com>
* feat: update minimum version to 1.22
* refactor: use int range iterator
* refactor: loop variables
* refactor: replace slicesext.FirstNonZero with cmp.Or
* refactor: use slices.Concat instead of append
* fix: unused param
* fix: linting
* fix: list-task with multiline desc
* feat: display all lines aligned in a table
* fix: display experiments
* use ladicle/tabwrite to handle color
* delete empty lines
Co-authored-by: Andrey Nering <andrey@nering.com.br>
* remove all /n and replace by space
---------
Co-authored-by: Andrey Nering <andrey@nering.com.br>