yadm-dev / yadm

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

What is the correct way to set environment variable? #439

Closed ByteDrummer closed 2 years ago

ByteDrummer commented 2 years ago

This question is about

Describe your question

My dotfiles aren't being generated correctly based on the environment variable I have set. It seems like yadm can't find the value for it. Does anyone know what I'm missing? Here is what I've tried:

$ yadm alt
Creating /home/eric/test from template /home/eric/test##template

$ echo $TEST
hello

$ cat test\#\#template
{% if env.TEST == "hello" %}
hello
{% else %}
bye
{% endif %}

$ cat test
bye
erijo commented 2 years ago

It doesn't look like env variables work in conditions, only in replacement, i.e. {{ env.TEST }} should work (if I'm reading the code correctly).

TheLocehiliosan commented 2 years ago

It doesn't look like env variables work in conditions, only in replacement, i.e. {{ env.TEST }} should work (if I'm reading the code correctly).

This answer is correct. Presently the built-in template only supports conditions using the yadm.* variables.