SuperCuber / dotter

A dotfile manager and templater written in rust 🦀
The Unlicense
882 stars 46 forks source link

[FEATURE] Different behaviours if file already present upon deployment #69

Closed lasse16 closed 3 years ago

lasse16 commented 3 years ago

Is your feature request related to a problem? Please describe. --force flag is given upon command execution. Hence it configures behaviour for every linking in that deployment process.

Describe the solution you'd like I would like to be able to specify in a complex target, the way an already existing file should be handled. Currently the file is either skipped, or overridden.

My suggestion is:

"source"={target="destination", type="template", merge="force"}

An added merge field, in which the behaviour can be specified. Possible options could be: force = override the file at target (like current force, but for a single file only} skip = skip the source file if target already present (like current default) append = append the current source to the target file prepend = prepend the current source to the target file custom = a shell command is triggered or a mergetool is opened

I consider custom to be low-priority as I dont need it and it probably is the greatest effort of all options suggested.

Describe alternatives you've considered I did not test this, but an alternative solution could be to write a pre_deploy-hook that checks for presence and stores it in a temporary file, later appending or prepending text.

Additional context My main concern for this feature is my .bash_history, where the order is not important.

SuperCuber commented 3 years ago

This is pretty low priority for me too, and I'd even close this if you don't think you need it.

lasse16 commented 3 years ago

Feel free to close this, I don't need it.

Jcambass commented 1 year ago

👋🏻 This would be a really handy feature! Especially for files like bashrc there often is existing configuration that I would want to keep and just apply my changes on top of it (append it for example).

SuperCuber commented 1 year ago

👋🏻 This would be a really handy feature! Especially for files like bashrc there often is existing configuration that I would want to keep and just apply my changes on top of it (append it for example).

@Jcambass PRs are welcome :)

quintrino commented 1 month ago

So my usecase for this is that currently I symlink my vlcrc file into Library/Preferences/org.videolan.vlc but it appears each time that vlc updates to a newer version, it replaces the symlink version with an actual copy and dotter then starts to fail.

adding this context just in case someone is considering doing a PR regarding this.