ccdiff - Colored character diff
ccdiff [options] file1|- file2|- ccdiff --help ccdiff --man ccdiff --info
Show a summary op the available command-line options and exit.
Show the version and exit.
Show this manual using pod2man and nroff.
Show this manual using pod2text.
All I/O (streams to compare and standard out) are in UTF-8.
Generate a unified diff. The number of context lines is optional. When omitted it defaults to 3. Currently there is no provision of dealing with overlapping diff chunks. If the common part between two diff chunks is shorter than twice the number of context lines, some lines may show twice.
The default is to use traditional diff:
5,5c5,5 < Sat Dec 18 07:00:33 1993,I.O.D.U.,,756194433,1442539 --- > Sat Dec 18 07:08:33 1998,I.O.D.U.,,756194433,1442539
a unified diff (-u1) would be
5,5c5,5 Tue Sep 6 05:43:59 2005,B.O.Q.S.,,1125978239,1943341 - Sat Dec 18 07:00:33 1993,I.O.D.U.,,756194433,1442539 + Sat Dec 18 07:08:33 1998,I.O.D.U.,,756194433,1442539 Mon Feb 23 10:37:02 2004,R.X.K.S.,van,1077529022,1654127
Show an additional line for each old or new section in a change chunk (not for added or deleted lines) that shows the hexadecimal value of each character. If --utf-8 is in effect, it will show the Unicode character name(s).
--utf-8
This is a debugging option, so invisible characters can still be "seen".
--verbose accepts an optional verbosity-level, but no specific behavior for these have not yet been defined.
--verbose
Use colors to show differences. As this is the default, use --no-color or --fancy to use markers instead of color indicators.
--no-color
--fancy
--no-color is especially useful if the terminal does not support colors, or if you want to copy/paste the output to (ASCII) mail.
Change the default red for deleted text to the color closest to pink that is supported by Term::ANSIColor: magenta.
red
magenta
Use (colored) Unicode indicators under changed text instead of the default ^.
^
I did consider using U+034e (COMBINING UPWARDS ARROW BELOW), but as most terminals are probably unable to show it, I did not pursue the idea.
Reverse the foreground and background for the colored indicators.
If the foreground color has bold, it will be stripped from the new background color.
bold
List available colors and exit.
Define the foreground color for deleted text.
Define the foreground color for added text.
Define the background color for changed text.
Prefix position indicators with an index.
If a positive number is passed (--index=4 or -I 4), display just the chunk with that index. This is useful in combination with --verbose.
--index=4
-I 4
Ignore case on comparison.
Ignore all white-space changes. This will set all options -b, -Z, -E, and -B.
-b
-Z
-E
-B
Ignore changes in trailing white-space (TAB's and spaces).
Ignore changes in horizontal white-space (TAB's and spaces). This does not include white-space changes that splits non-white-space or removes white-space between two non-white-space elements.
NYI
Just Partly Implemented (WIP)
In order to be able to overrule the defaults set in ccdiff, one can set options specific for this login. The following option files are looked for in this order:
ccdiff
- $HOME/ccdiff.rc - $HOME/.ccdiffrc - $HOME/.config/ccdiff
and evaluated in that order. Any options specified in a file later in that chain will overwrite previously set options.
Option files are only read and evaluated if it is not empty and not writeable by others than the owner.
The syntax of the file is one option per line. where leading and trailing white-space is ignored. If that line then starts with one of the options listed below, followed by optional white-space followed by either an = or a :, followed by optional white-space and the values, the value is assigned to the option. The values no and false (case insensitive) are aliases for 0. The values yes and true are aliases to -1 (-1 being a true value).
=
:
no
false
0
yes
true
-1
Between parens is the corresponding command-line option.
color : true
defines if colors should be used. The default is to use colors. The -c command line option will toggle the option when set from a configuration file.
-c
reverse : false
defines if changes are displayed as foreground-color over background-color or background-color over foreground-color. The default is false, so it will color the changes withe the appropriate color (new or old) over the default background color.
new
old
new : green
defines the color to be used for added text. The default is green.
green
any color accepted by Term::ANSIColor is allowed. Any other color will result in a warning. This option can include bold either as prefix or as suffix.
This option may also be specified as
new-color new_color new-colour new_colour
old : red
defines the color to be used for delete text. The default is red.
old-color old_color old-colour old_colour
bg : white
defines the color to be used as background for changed text. The default is white.
white
any color accepted by Term::ANSIColor is allowed. Any other color will result in a warning. The bold attribute is not allowed.
bg-color bg_color bg-colour bg_colour background background-color background_color background-colour background_colour
verbose : cyan
defines the color to be used as color for the verbose tag. The default is cyan. This color will only be used under --verbose.
cyan
any color accepted by Term::ANSIColor is allowed. Any other color will result in a warning.
verbose-color verbose_color verbose-colour verbose_colour
utf8 : yes
defines whether all I/O is to be interpreted as UTF-8. The default is no.
unicode utf utf-8
index : no
defines if the position indication for a change chunk is prefixed with an index number. The default is no. The index is 1-based.
Without this option, the position indication would be like
5,5c5,5 19,19d18 42a42,42
with this option, it would be
[001] 5,5c5,5 [002] 19,19d18 [005] 42a42,42
When this option contains a positive integer, ccdiff will only show diff the diff chunk with that index.
Algorithm::Diff, Text::Diff
H.Merijn Brand
Copyright (C) 2018-2018 H.Merijn Brand. All rights reserved.
This library is free software; you can redistribute and/or modify it under the same terms as Perl itself.
To install App::ccdiff, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::ccdiff
CPAN shell
perl -MCPAN -e shell install App::ccdiff
For more information on module installation, please visit the detailed CPAN module installation guide.