Giter Site home page Giter Site logo

daveewart / colordiff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kimmel/colordiff

173.0 173.0 37.0 306 KB

Primary development for colordiff

Home Page: http://www.colordiff.org/

License: GNU General Public License v2.0

Shell 9.22% Perl 81.92% Makefile 8.86%

colordiff's People

Contributors

dabedotcom avatar daveewart avatar gedge avatar jszakmeister avatar kimmel avatar lekensteyn avatar matthiasdiener avatar michael-o avatar neo-oli avatar okorz001 avatar pvdb avatar rfdonnelly avatar rkitover avatar scop avatar vaeth avatar vitahall avatar ymattw avatar zmwangx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

colordiff's Issues

Feature request: colors for comparing folders

I often need to compare folders overview-wise, i.e. using colordiff -rq.

It would be helpful to have these cases colored differently:

  • Only in [first folder]
  • Only in [second folder]
  • Files a and b differ
  • (only with --no-dereference) symlink targets are different
  • File a is a fifo/socket/... while file b is a fifo/socket/...

intraline syntax highlighting fails when spanning newline char

colordiff currently improperly highlights changes when there's a newline char between the brackets such as in the case of

foo [-bar
bash-] derp

this is the default mode for wdiff

expected highlighting to be similar to wdiff -n

foo [-bar-]
[-bash-] derp

screen shot 2016-08-13 at 11 07 38 am
screen shot 2016-08-13 at 11 07 55 am

Support for diff3?

Received an email asking whether colordiff supports diff3.

This is presumably an easy enough enhancement, provided the diff3 output format is specific and unique.

colordiff-1.0.17 doesn't colorize anymore when piped through less

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.

Option to specify a local config file

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.

Highlighting for "Binary files differ" lines

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.

colordiff -y: no colour output on MacOS

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

Issue Detail

The output of the following to commands is identical (i.e. no colouring at all)

colordiff -y file1 file2
diff -y file1 file2 | colordiff

Steps Taken

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

[Bug] /etc/colordiffrc color_patches gets always overriden and can't redirect color to file

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:

How to reproduce

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

Here is an image:
image

Affected version

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

Unified diff header is highlighted as changes

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.

colordiff -y not outputting color on CentOS7

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.

Example of no color output

Environment:

  • cat /etc/centos-release = CentOS Linux release 7.5.1804 (Core)
  • colordiff --version = diff (GNU diffutils) 3.3
  • sudo yum info diffutils = Version : 3.3 | Release : 5.el7
  • sudo yum info colordiff = Version : 1.0.13 | Release : 2.el7
  • Terminal = PuTTY Release 0.74
  • OS = Microsoft Windows 10 Home | Version 10.0.19041 Build 19041

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

Only working edge case for -y --left-column

Support for true color

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.

colordiff options not documented?

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.

Need of using /etc

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 fails for xml

Steps to reproduce:

  • Install phpstorm
  • Copy ~/.idea/codeStyleSettings.xml to ~/first/
  • Install DB Navigator plugin & restart
  • Copy ~/.idea/codeStyleSettings.xml to ~/second/
  • grep DBN ~/first/* ~/second/*
  • 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>

Output is empty when --difftype is specified and the specified type is not diffy

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.

manpage?

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

Missing option to control on/off ansi color code easily

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

Provide current release tarball in "archive"?

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?

[0]
http://www.gnu.org/software/guix/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.