mookid / diffr

Yet another diff highlighting tool
MIT License
572 stars 22 forks source link

diffr: read config from .gitconfig files. #62

Closed mookid closed 1 year ago

mookid commented 4 years ago

This allows to configure the flags of diffr with a section like the following:

[diffr] line-numbers = true colors = refine-added:none:background:cyan:bold colors = refine-removed:none:background:magenta:bold

which corresponds to the invocation:

diffr \ --line-numbers \ --colors refine-added:none:background:cyan:bold \ --colors refine-removed:none:background:magenta:bold

If you use diffr without git, the option --no-gitconfig disables reading the .gitconfig files.

Fix #41

mookid commented 4 years ago

TODO: update readme, update --help, add tests?

@waldyrious please let me know what you think.

waldyrious commented 4 years ago

@mookid I think it would be good if diffr used the same formatting syntax as git config uses, as I suggested earlier in #41. That would also make these configurations more portable, since delta, diff-highlight and diff-so-fancy also use them, so it would be easier for people who are using some of these tools to migrate their setup to diffr.

Do you think it would be easier to implement this feature in as-is and later change the syntax, or to implement it in the git-compatible syntax from the get-go? I'd rather wait a longer time for this feature than not have the compatibility at all.

waldyrious commented 4 years ago

(I wonder if any of @dandavison's code could be of help here, especially since delta is also written in rust.)

mookid commented 4 years ago

@waldyrious I don't think that this code is useful for that purpose.

Can you share some code with a proposal of the behaviour you would like to see, based on that PR? I think that is possible to extend the pattern of accepted options easily.

waldyrious commented 4 years ago

Can you share some code with a proposal of the behaviour you would like to see, based on that PR?

Sorry, I am only familiar with delta's interface as an end-user, not with its code. Feel free to ignore my suggestions, by the way :) I'm just providing my input, for what it's worth, as someone who's experimenting with diffr; but the final decision of what syntax to use and how to implement this feature is, of course, yours.