twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.85k stars 477 forks source link

Use a template to create a directory of files in different locations across OSes #2587

Closed baslat closed 1 year ago

baslat commented 1 year ago

What exactly are you trying to do?

I currently use templates to manage machine-to-machine differences for single files. However, I have the situation where I have a folder of files that are in different locations across OSes. AFAICT the only way to manage this would be to create a template for each file. I would like to be able to specify the folder location with a template, and have the contents be placed appropriately (without having to create a template for each file).

For example, on MacOS the paths might be:

~/thefolder/file1.txt
~/thefolder/file2.txt
~/thefolder/file3.txt
# etc

And on Windows

~/extrafolder/thefolder/file1.txt
~/extrafolder/thefolder/file2.txt
~/extrafolder/thefolder/file3.txt
# etc

What have you tried so far?

Reading the documentation, searching the github issues, searching the internet, experimenting with templates.

Where else have you checked for solutions?

Output of any commands you've tried with --verbose flag

NA

Output of chezmoi doctor

NA

Additional context

NA

twpayne commented 1 year ago

See https://www.chezmoi.io/user-guide/manage-machine-to-machine-differences/#handle-different-file-locations-on-different-systems-with-the-same-contents.

twpayne commented 1 year ago

Hopefully this answers your question. See also #2273 and #2335 that should make this easier in the future. Please re-open if needed.

baslat commented 1 year ago

Thanks, I think #2273 is the feature I'm after.