Replies: 2 comments 4 replies
-
Each template is run isolated and as far as I can tell has no way of modifying the chezmoi runtime data. You could consider writing the comparison to a temporary file which then gets deleted using a |
Beta Was this translation helpful? Give feedback.
-
If you use chezmoi to store the version number somewhere, and read it inside the source state, it will always be behind the source state. Take the following for example:
If you set the contents of the Not to mention that this violates the assumption that the source and destination states do not change while chezmoi is running. Do you have any particular concerns with your current implementation? It looks fine to me, you're always reading the version when you need it, and it's always going to be correct. |
Beta Was this translation helpful? Give feedback.
-
I use
mpv
media player on two different computers. Because they have different versions ofmpv
, I have to make some adjustments andchezmoi
is perfect for this job.For example, in my
.chezmoiexternal.toml
I have:Then in my
mpv.conf.tmpl
I need the version number again because older versions don't support certain settings:This setup works, but I'm just wondering if there's a way to store
$mpv_version
only once when I runchezmoi apply
and use its value in different files? Storing it in thechezmoi
config file requires running an explicit init command and I would have to remember to do that whenmpv
is updated to newer versions.Beta Was this translation helpful? Give feedback.
All reactions