Closed MunifTanjim closed 3 years ago
joinPath
might need some updating to be able to take either strings or AbsPath
or RelPath
. In the meantime, you can work around this by doing something to cause .chezmoi.sourceDir
to get converted to a string. One easy way to do that is with the cat
function from Sprig:
$ echo '{{ joinPath (cat .chezmoi.sourceDir) "example" }}' | chezmoi execute-template
/home/zb/.local/share/chezmoi/example
(Incidentally, I'm not sure why cat
can coerce .chezmoi.sourceDir
into a string but joinPath
can't. That might be an interesting avenue of investigation. Edit: ah, it's because cat
takes interface{}
s rather than string
s. For joinPath
it's probably best to limit it to strings or *Path
types if possible.)
Oops, hit the wrong button :smile:
In the interest of adding something new to the discussion, you can also use the built-in printf
if you find that seems easier to reason about. For example:
$ echo '{{ joinPath (printf "%v" .chezmoi.sourceDir) "example" }}' | chezmoi execute-template
/home/zb/.local/share/chezmoi/example
Many thanks for reporting this @MunifTanjim and for the quick work-around @zb140 :)
Describe the bug
joinPath
does not work with.chezmoi.sourceDir
To reproduce
Expected behavior
Work similar to this:
Output of command with
--verbose
Output of
chezmoi doctor
Additional context
N/A