diffr icon indicating copy to clipboard operation
diffr copied to clipboard

diffr: read config from .gitconfig files.

Open mookid opened this issue 5 years ago • 5 comments

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 avatar Jul 14 '20 00:07 mookid

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

@waldyrious please let me know what you think.

mookid avatar Jul 14 '20 00:07 mookid

@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 avatar Jul 14 '20 21:07 waldyrious

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

waldyrious avatar Jul 14 '20 21:07 waldyrious

@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.

mookid avatar Jul 15 '20 13:07 mookid

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.

waldyrious avatar Jul 16 '20 22:07 waldyrious