twpayne / chezmoi

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

`--follow` flag for `chezmoi apply` #4102

Open leonfeng opened 2 days ago

leonfeng commented 2 days ago

Is your feature request related to a problem? Please describe.

I use WSL on Windows 11. The vast majority of my dotfiles sit in my Linux home folder. However, there are a few Windows config files that I'd like Chezmoi to manage.

So far, I have symlinked to and chezmoi add --followed these Windows config files. But when applying, Chezmoi overwrites the Linux symlinks instead of following them.

Describe the solution you'd like

A --follow flag will allow chezmoi apply to selectively overwrite the target files of the symlinks and not the symlinks themselves.

Describe alternatives you've considered

Additional context

Right now I'm copying these config files between Windows and Linux each time there's a change, and it gets old very quickly. Thank you for reading my feature request!

KapJI commented 2 days ago

You should be able to manage Windows configs with .chezmoiignore and templates, there is no need for symlinks.

halostatue commented 2 days ago

I believe that what @leonfeng is looking for is running chezmoi once from their WSL instance where they have placed symlinks of Windows configuration files somewhere in that instance.

I don't see this being implemented because this makes chezmoi apply even less predictable in behaviour:

Additionally, on Windows/WSL you have the fact that Windows files use CRLF newlines and Linux — even under WSL — uses LF newlines.