mookid/diffr

Feature request: support configuration via environment variable or config file

Closed this issue · 8 comments

I think it would be convenient if the --colors parameter wasn't the only way to customize the colors. Maybe if --colors is not provided, look in an environment variable? I guess using a config file is over-engineered.

For the time being, a short wrapper shell script will do the trick, of course.

I think that the program is not complex enough to enough to justify a config file for now.

@mookid please reconsider. I've been following the development of a similar tool, and since they introduced git-config-based customization, the tool has been much more convenient to use and to tweak.

For reference, here's the invocation I currently have to use to tweak diffr's colors to match my preference (basically, mimicking diff-highlight):

diffr --colors refine-removed:foreground:black:nobold --colors refine-added:foreground:black:nobold

Having those settings in gitconfig, like this:

[core]
    pager = diffr | less -R

[interactive]
    diffFilter = diffr

[diffr "colors"]
    refine-removed = foreground:black:nobold 
    refine-added   = foreground:black:nobold

...would be much more manageable :)

Hi @waldyrious, reopening. I won't say that this is high in my priority list, but could land sometime. The .gitconfig is indeed a nice place where to put the config if that's possible (even if I a not thrilled about being git specific).

@waldyrious I wonder what you think about the compromise to put the long command line into the git config?

[interactive]
diffFilter = diffr --colors refine-removed:foreground:black:nobold --colors refine-added:foreground:black:nobold

It is, as you say, a workaround. It works, of course, but I'd like to be able to tweak the configuration more easily than editing a long string with a custom grammar. Using separate configuration entries makes the configuration easier to write, and easier to read. Also, it could reuse the same formatting specifications that git already uses, so that would be one less DSL to learn.

xeruf commented

@waldyrious I wonder what you think about the compromise to put the long command line into the git config?

[interactive]
diffFilter = diffr --colors refine-removed:foreground:black:nobold --colors refine-added:foreground:black:nobold

@grossjohann if you also want to use it in core.pager then you'd have to duplicate it or use an external script :/

@mookid I see you closed this issue as "completed". Did you mean to close it as "not planned"? Or did I miss something?

yes, that's correct. I have no time to implement that, and nobody suggested code to do it either; as cleaning up the backlog, I closed the issue.