TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.94k stars 178 forks source link

Support "!=" in built-in template processor #358

Open xenoterracide opened 3 years ago

xenoterracide commented 3 years ago

maybe a bug, maybe a PEBCAK (I apologize if it is), I have this code, but for some reason the output of yadm alt doesn't include the contents of the developer.sh

{% if yadm.user != "root" %}
  {% include "../extra/developer.sh" %}
{% endif %}

https://github.com/xenoterracide/dotfiles/blob/2002b498c5bfad7c93b959dcbbf7e75fdb69d4a2/.config/yadm/alt/.zshrc%23%23template%2Ce.zsh#L34

erijo commented 3 years ago

Does it work if you instead use == and put the include in an else clause?

xenoterracide commented 3 years ago

yes and no, this doesn't, it treats the include as just text, but if I remove the indentation it works. changing that may be another ticket... though the way I'd like it to behave is include that code prepended with that indentation. I don't think I should need the else for this though.

{% if yadm.user == "root" %}
{% else %}
  {% include "../extra/developer.zsh" %}
{% endif %}
erijo commented 2 years ago

Yes, {% must be first on the line and only == is supported. For more advanced templates you could perhaps use ninja instead?

xenoterracide commented 2 years ago

maybe, but only having == is unintuitive. If that's all that can be supported perhaps it's possible to throw an error? I honestly haven't considered my config to be particularly complicated, honestly this is the only conditional I have.

github-actions[bot] commented 2 years ago

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.