Open xNok opened 3 months ago
I ran some more experiments
{{ relPath (shell "bash" "-c" "echo $PWD") outputFolder }}
This results in ../../subfolder/subsubfolder
, so my conclusion is that $PWD
is actually the template folder. So there is know what to obtain the path from where the command Is executed atm.
Ah, adding a workingDir
param to the context, which contains the path where you ran boilerplate
, is a good idea. A PR for that is very welcome!
In the meantime, if you're looking for the root of a Git repo, perhaps with a shell command, you could use git rev-parse --show-toplevel
?
I will look into making a PR, just need to put my head into the code at some point.
The best working solution so far
{{ relPath (env "PWD" "NO_FOUND") outputFolder }}
Assuming that you run boilerplate at the root of a repo and want to start building a relative path to the root. How would you go about obtaining those paths?
Here is an example structure
Then then then I run
I would want
testfile.txt
to contain./subfolder/subsubfolder
I tried some hacks using shell, but interpolation does seem to occur in that way
Maybe We could consider providing this out of the box in a variable.