diffr icon indicating copy to clipboard operation
diffr copied to clipboard

Feature request: support configuration via environment variable or config file

Open grossjohann opened this issue 6 years ago • 6 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.

grossjohann avatar Dec 11 '19 10:12 grossjohann

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

mookid avatar May 23 '20 16:05 mookid

@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 :)

waldyrious avatar Jul 11 '20 22:07 waldyrious

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

mookid avatar Jul 13 '20 19:07 mookid

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

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.

waldyrious avatar Jul 13 '20 21:07 waldyrious

@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 :/

xeruf avatar Jan 19 '21 09:01 xeruf

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

waldyrious avatar Dec 30 '22 11:12 waldyrious

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.

mookid avatar Dec 30 '22 12:12 mookid