yadm icon indicating copy to clipboard operation
yadm copied to clipboard

Support nested ifs for built-in template processor

Open nolith opened this issue 2 years ago • 1 comments

Describe the bug

A template with a nested if do not work and renders with an extra {% endif %}

To reproduce

Can this be reproduced with the yadm/testbed docker image: No - I wasn't able to make yadm alt work on the container

Steps to reproduce the behavior:

  1. Run command
cat << EOF > test.conf\#\#template
{% if yadm.os == "Darwin" %}
{% if yadm.arch == "arm64" %}
macOS arm64
{% else %}
macOS amd64
{% endif %}
{% endif %}
EOF
  1. Run command yadm add test.conf##template
  2. Run command yadm alt
  3. See error cat test.conf
macOS arm64
{% endif %}

Expected behavior

test.conf should have only included one line macOS arm64

Environment

  • Operating system: macOS
  • Version yadm: 3.2.1
  • Version Git: 2.37.2

Additional context

[Add any other context about the problem here.]

nolith avatar Sep 09 '22 08:09 nolith

This is currently working as intended. The built-in template processing is for very simple cases, and does not support nested conditionals. I'll change this issue to be a feature request.

TheLocehiliosan avatar Sep 13 '22 16:09 TheLocehiliosan