|
Is it possible, especially with Tasks, to set E.g., _tasks:
- command: "git init"
when: "! git log -1 --pretty=oneline || false"In my example, If this isn't already possible, perhaps it could be possible to implement something like |
Replies: 1 comment 3 replies
|
How about using, e.g., _jinja_extensions:
- jinja2_shell_extension.ShellExtension
_tasks:
- command: "git init"
when: "{{ 'git log -1 --pretty=oneline && echo \"false\" || echo \"true\"' | shell }}"(Disclaimer: I haven't tested this template, but this or something similar should work.) Or you could register your own tiny Jinja2 extension that directly translates a shell exit code to |
How about using, e.g.,
jinja2-shell-extensionand calling your status command in awhentemplate?(Disclaimer: I haven't tested this template, but this or something similar should work.)
Or you could register your own tiny Jinja2 extension that directly translates a shell exit code to
"true"/"false". See, e.g., https://github.com/pawamoy/copier-uv/blob/main/extensions.py + https://github.com/pawamoy/copier-uv/blob/main/copier.yml#L11-L14.