dotter icon indicating copy to clipboard operation
dotter copied to clipboard

Show difference between source and destination file

Open stfnx opened this issue 3 years ago • 1 comments

Dotter version: 0.12.9

Some of my configuration files are using templates. I know that they are generated to .dotter/cache and then copied to the target location. This works fine.

But sometimes the target file changes. In this case I get the following error message:

[ERROR] Updating template "sublime-text/settings.json" -> "/home/stfnx/.config/sublime-text/Packages/User/Preferences.sublime-settings" but target contents were changed. Skipping.
[ERROR] Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag.

This is totally understandable and the desired behavior. But how am I supposed to get the changes in the target file back to my template?

I could do it manually using diff:

diff ~/dotfiles/.dotter/cache/sublime-text/settings.json ~/.config/sublime-text/Packages/User/Preferences.sublime-settings

Sure this does work but it is cumbersome and a lot to type.

When running dotter --help I can see a --diff-context-lines option. This gave me the impression that there must be a diff option baked into dotter. But I couldn't find it...

Does dotter have a diff option? If not, is it planned? Is there an easier way to do it?

stfnx avatar Feb 11 '22 14:02 stfnx

This has been planned but I don't have the time to work on this nowadays - PRs are appreciated.

SuperCuber avatar Feb 11 '22 16:02 SuperCuber