daveewart / colordiff Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kimmel/colordiff
Primary development for colordiff
Home Page: http://www.colordiff.org/
License: GNU General Public License v2.0
This project forked from kimmel/colordiff
Primary development for colordiff
Home Page: http://www.colordiff.org/
License: GNU General Public License v2.0
seems like it's only possible to disable the banner via a config file
I often need to compare folders overview-wise, i.e. using colordiff -rq.
It would be helpful to have these cases colored differently:
Received an email asking whether colordiff supports diff3.
This is presumably an easy enough enhancement, provided the diff3 output format is specific and unique.
Since updating to 1.0.17 colordiff doesn't colorize diffs anymore when piped through less. It even worked without passing -R/-r to less in the past, but now that doesn't help either. Nor does explicitly passing --color=yes to colordiff or setting color_patches=yes.
Version of less is 492.
Hi.
colordiff
looks up colordiffrc
in /etc
and home, but I like to have a specific setup in a folder local to my project since then I call colordiff
by other scripts that run checks (e.g. check expected to generated output while running test cases).
So, something like colordiff --configfile=local_config_rc
and/or colordiff "--config=newtext=blah;oldtext=foo"
.
Thank you.
It would be useful to have a way to highlight diff's "Binary files x and y differ" lines. This would make it easier to distinguish those lines from normal file content (when using unified or context diffs), especially when quickly scanning a long diff.
on Amazon linux 2012.03:
$ yum install colordiff
No package colordiff available.
I'm able to get coloured output with a standard colordiff, but not when the -y arg (side-by-side output) is provided.
A previous issue on this topic appeared to be resolved by updating to the latest colordiff release, I believe I am already running on 1.0.20
Field | Value |
---|---|
MacOS | Monterey 12.3 |
CPU | M1 - ARM-based |
package manager | brew |
coreutils | gnu - via brew |
colordiff --version |
diff (GNU diffutils) 2.8.1 |
which colordiff |
/opt/homebrew/bin/colordiff |
brew info colordiff |
colordiff: stable 1.0.20 (bottled) ... /opt/homebrew/Cellar/colordiff/1.0.20 (10 files, 60.7KB) * |
The output of the following to commands is identical (i.e. no colouring at all)
colordiff -y file1 file2
diff -y file1 file2 | colordiff
I have tried to run with a variety of additional args (--strip-trailing, --supress-common-lines) and tried diff'ing several files - all with the same result.
Any help would be much appreciated, colordiff is a huge improvement over the original diff, much appreciation for your work!
Cheers,
Guy
Hi!
I'm working on a set of scripts that are running on GitlabCI where I was trying to use colordiff to make the output more friendly.
For more context I'm using kubectl diff
together with export KUBECTL_EXTERNAL_DIFF="colordiff"
so I don't really have control over colordiff arguments like --color=yes
. Instead I need to rely on /etc/colordiffrc
.
The problem is:
color_patches=yes
inside /etc/colordiffrc
Which given this logic https://github.com/daveewart/colordiff/blob/current/colordiff.pl#L213-L218 it makes $color_patch = 1
color_mode
which is defaulted to auto
will always unset color_patch
with $color_patch = undef;
Set of steps to reproduce
❯ docker run -it alpine
/ # apk update
/ # apk add colordiff
/ # echo "foo" > 1
/ # echo "bar" > 2
/ # colordiff 1 2
# This will print out the diff patch with colors. EXPECTED
/ # colordiff 1 2 > testfile
/ # cat testfile
# This will print out the diff patch without colors. EXPECTED
/ # sed -i -e 's/color_patches=no/color_patches=yes/g' /etc/colordiffrc # This overrides the configuration to enable colors when doing redirects
/ # colordiff 1 2 > testfile
/ # cat testfile
# This will print out the diff patch without colors. HERE IS THE BUG
I found this in the latest packages of arch and alpine docker which points to colordiff v1.0.18
I hope the ticket is clear enough cc @daveewart
Hi.
$ diff -u <(echo 1) <(echo 2) | colordiff
will interpret the lines like
#oldtext # --- /dev/fd/63 2018-06-16 18:42:33.702021285 +0200
#newtext # +++ /dev/fd/62 2018-06-16 18:42:33.702021285 +0200
#diffstuff# @@ -1 +1 @@
#oldtext # -1
#newtext # +2
The lines starting with 3 minus or pluses are all diff metadata or context. They are not removed nor added lines, so they should be styles with the diffstuff
color.
Thank you.
I recently posted here of what I thought was user error while using
colordiff
but after some troubleshooting, I believe that it may be a bug. Below is a copy of my issue. Looking for some help, please.
For the life of me, I cannot get colordiff
to output color to the terminal. I feel like I am missing something simple.
Environment:
cat /etc/centos-release
= CentOS Linux release 7.5.1804 (Core)colordiff --version
= diff (GNU diffutils) 3.3sudo yum info diffutils
= Version : 3.3 | Release : 5.el7sudo yum info colordiff
= Version : 1.0.13 | Release : 2.el7The specific command I am trying:
\colordiff -y --left-column /opt/projects/openidm/subscribers/conf/authentication.json /opt/projects/git/subscribers/conf/authentication.json
Commands I have tried but will not output color:
\colordiff -y --left-column <File-1> <File-2>
\colordiff -y --left-column --difftype=diffy <File-1> <File-2>
Commands that will output color in the terminal for all files:
\colordiff <File-1> <File-2>
\colordiff -y --ignore-trailing-space <File-1> <File-2>
\colordiff -y --ignore-trailing-space --suppress-common-lines <File-1> <File-2>
\colordiff -y --left-column --ignore-trailing-space --suppress-common-lines <File-1> <File-2>
Commands that output color depending on the type of "diffs" in the files:
\colordiff -y --left-column --suppress-common-lines <File-1> <File-2>
\colordiff -y --left-column --suppress-common-lines --difftype=diffy <File-1> <File-2>
\colordiff -y --suppress-common-lines <File-1> <File-2>
\colordiff -y --suppress-common-lines --difftype=diffy <File-1> <File-2>
\colordiff -y <File-1> <File-2>
\colordiff -y --difftype=diffy <File-1> <File-2>
\diff -y <File-1> <File-2> | \colordiff
\diff -y <File-1> <File-2> | \colordiff --difftype=diffy
Note: I have preceded most commands with a \
to make sure no aliases are involved.
Update: After trying multiple files for comparison, it turns out that the original files I was comparing had a trailing space that was causing an issue. That said, the issue still requires that I add --suppress-common-lines
to my original command, even though in my case, that only removes 2 lines from the output.
Would be nice to have support for true color in .colordiffrc
.
The escape sequence to set the foreground color is <ESC>[38;2;r;g;bm
where r
, g
, and b
are integers 0-255. Substitute 38
with 48
to set background color.
It'd also be nice to be able to set the bold attribute with these.
A simple way to handle both would be to scan the color value for semi-colons (;
), and if present, assume it's everything that goes between the [
and m
in the above sequence.
Howdy.
I've installed colordiff
normally through my distribution (ubuntu) and man colordiff
does not document the colordiff options
in a clear way. There are some references to command line options lost in the text.
Also, the config file format is not documented in the man page, so the user has to read through /etc/colordiffrc
.
I tried colordiff --help
but that is just interpreted as diff --help
.
What I was looking at was options to customize the colors directly with arguments or point to some local config file. I realize now those use cases are not covered but I had to look through the code to find that out. But this is another issue.
Thank you.
Hello
How obtain a pdf/img result of colordiff?
The result is perfect in screen, but for export ?
Many thanks
Add some way to show intra-line differences.
There's already a perl script [1] in git contrib that does this, so merging the two may be easy (particularly because they're both GPL2 licence)
[1] https://github.com/git/git/blob/master/contrib/diff-highlight/diff-highlight
Hello folks,
I don't have sudo privileges on my workstation, so I have to use my own environment. I was willing to install colordiff by:
make install INSTALL_DIR=$MY_TOOLS/bin MAN_DIR=$MY_TOOLS/man/man1
However, taking a look into the install commands with make install -n
I saw that they use /etc
:
if [ -f /etc/colordiffrc ]; then \ mv -f /etc/colordiffrc \ /etc/colordiffrc.old; \ else \ install -d /etc; \ fi cp colordiffrc /etc/colordiffrc chown root.root /etc/colordiffrc chmod 644 /etc/colordiffrc
Which environment variable should I load so that colordiff looks in the right path $TOOLS/etc
instead of /etc
?
Thanks in advance.
colordiff 1.0.13 (http://www.colordiff.org/)
(C)2002-2012 Dave Ewart, [email protected]
Steps to reproduce:
colordiff ~/first/codeStyleSettings.xml ~/second/codeStyleSettings.xml
fails, but
colordiff --color=no ~/first/codeStyleSettings.xml ~/second/codeStyleSettings.xml
succeeds.
Sample xml:
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
A very simple example: for 1.0.14 and 1.0.15,
diff file1 file2 | colordiff
works as expected, but
diff file1 file2 | colordiff --difftype=diff
produces empty output all the time. This worked back in 1.0.13.
The offending commit seems to be 384eea6 according to git-bisect.
I didn't read the code in detail so I'm not sure how $lastline
is exactly useful, but my impression is that when --difftype
is specified but the specified type is not diffy
, then @inputstream
would be empty and $lastline
would be undef
(although technically we assigned $_
to $lastline
in line 315, it doesn't really help since the condition ($diff_type eq 'diffy' and ($_ = <STDIN>))
results in an undefined $_
when diff type is not diffy
), so when we reach the loop
while (defined( $_ = @inputstream ? shift @inputstream : ($lastline and <STDIN>) )) {
the condition is immediately false although there's stuff in <STDIN>
(which was later changed to $inputhandle
).
Again, I didn't read the code in detail, so I won't try to submit a patch, which might break other things.
There is no manpage in the repo.
make install dies on the lines:
install -Dm 644 colordiff.1 ${DESTDIR}${MAN_DIR}/colordiff.1
install -Dm 644 cdiff.1 ${DESTDIR}${MAN_DIR}/cdiff.1
Hi,
I have a use case like this:
Use colordiff to view the diff
svn diff | colordiff
Apply the patch to another dir (arrow up and edit last command in my shell)
svn diff | colordiff | patch -p0 -d another-working-copy
Unfortunately this does not work since ansi color chars are piped out to patch
. I have to save the diff first:
svn diff | colordiff > my.patch
patch -p0 -d another-working-copy < my.patch
This is somehow inconvenient, could you provide a short option to on/off the ansi color code, just like what grep
has (grep --color=never,always,auto
)?
Thanks,
Matt
Hi,
I'm working on the colordiff package for GNU Guix [0].
I noticed that the URL for the current release is structured differently from all the archived releases. For example, the current release is not available at :
http://colordiff.org/archive/colordiff-1.0.16.tar.gz
Would you consider making the current release tarball available under the "archive" directory so that packagers could rely on the single URL?
Colordiff fails to install on MacOS since its install
program does not support the -D
option:
$ install -Dm
install: illegal option -- D
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.