-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathccdiff.3
780 lines (780 loc) · 24.8 KB
/
ccdiff.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "App::ccdiff 3"
.TH App::ccdiff 3 2025-01-03 "perl v5.40.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
ccdiff \- Colored Character diff
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 2
\& ccdiff [options] file1|\- file2|\-
\& ccdiff [options] dir1 dir2
\&
\& ccdiff \-\-help
\& ccdiff \-\-man
\& ccdiff \-\-info
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
Show the diff between two files on a character by character base. In contrast to
the standard diff tools, this tool uses the diff algorithm horizontally for each
line in the vertical diff, highlighting the changes. This is very handy in hard
to spot changes like \f(CW\*(C`O\*(C'\fR to \f(CW0\fR, \f(CW\*(C`I\*(C'\fR to \f(CW\*(C`l\*(C'\fR or \f(CW1\fR and whitespace.
.PP
If there are two argument, and both are a folder/directory, a recursive diff is
executed. This is not available whan used as a (sub)class.
.SH OPTIONS
.IX Header "OPTIONS"
.SS "Command line options"
.IX Subsection "Command line options"
.IP "\-\-help \-?" 2
.IX Item "--help -?"
Show a summary of the available command\-line options and exit.
.IP "\-\-version \-V" 2
.IX Item "--version -V"
Show the version and exit.
.IP \-\-man 2
.IX Item "--man"
Show this manual using pod2man and nroff.
.IP \-\-info 2
.IX Item "--info"
Show this manual using pod2text.
.IP "\-\-utf\-8 \-U" 2
.IX Item "--utf-8 -U"
All I/O (streams to compare and standard out) are in UTF\-8.
.IP "\-\-diff\-class=C \-\-dc=C \-\-pp" 2
.IX Item "--diff-class=C --dc=C --pp"
Select the class used to execute the diff. By default \f(CW\*(C`ccdiff\*(C'\fR will select
the first available out of \f(CW\*(C`Algorithm::Diff::XS\*(C'\fR or \f(CW\*(C`Algorithm::Diff\*(C'\fR.
.Sp
Sometime the \f(CW\*(C`XS\*(C'\fR version fails on encoding and the pure\-perl version will
work just fine. You can force \f(CW\*(C`ccdiff\*(C'\fR to use either
.Sp
Select the pure\-perl version with any of \f(CW\*(C`PP\*(C'\fR, \f(CW\*(C`AD\*(C'\fR, \f(CW\*(C`Algorthm::Diff\*(C'\fR,
\&\f(CW\*(C`Algorithm\-Diff\*(C'\fR, or \f(CW\*(C`Algorithm::Diff::PP\*(C'\fR (case insensitive).
For convenience, \f(CW\*(C`\-\-dc=pp\*(C'\fR can be abbreviated to \f(CW\*(C`\-\-pp\*(C'\fR.
.Sp
.Vb 4
\& \-\-pp
\& \-\-dc=pp
\& \-\-dc=algorithm\-diff
\& \-\-diff\-class=Algorithm::Diff::PP
.Ve
.Sp
Select the XS version with any of \f(CW\*(C`XS\*(C'\fR, \f(CW\*(C`ADX\*(C'\fR, \f(CW\*(C`Algorthm::Diff::XS\*(C'\fR, or
\&\f(CW\*(C`Algorithm\-Diff\-XS\*(C'\fR (case insensitive).
.Sp
.Vb 3
\& \-\-dc=xs
\& \-\-dc=algorithm\-diff\-xs
\& \-\-diff\-class=Algorithm::Diff::XS
.Ve
.IP "\-\-unified[=3] \-u [3]" 2
.IX Item "--unified[=3] -u [3]"
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.
.Sp
The default is to use traditional diff:
.Sp
.Vb 4
\& 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
.Ve
.Sp
a unified diff (\-u1) would be
.Sp
.Vb 5
\& 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
.Ve
.IP "\-\-verbose[=1] \-v[1]" 2
.IX Item "--verbose[=1] -v[1]"
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
\&\f(CW\*(C`\-\-utf\-8\*(C'\fR is in effect, it will show the Unicode character name(s).
.Sp
This is a debugging option, so invisible characters can still be "seen".
.Sp
\&\f(CW\*(C`\-\-verbose\*(C'\fR accepts an optional verbosity\-level. On level 2 and up, all
horizontal changes get left\-and\-right markers inserted to enable seeing the
location of the ZERO WIDTH or invisible characters. With level 3 and up and
Unicode enabled, the changed characters will also show the codepoint in hex.
.Sp
An example of this:
.Sp
With \-Uu0v0:
.Sp
.Vb 3
\& 1,1c1,1
\& \- A BCDE Fg
\& + A BcdE\:Fg
.Ve
.Sp
With \-Uu0v1:
.Sp
.Vb 5
\& 1,1c1,1
\& \- A BCDE Fg
\& \- \-\- verbose : SPACE, LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER D, SPACE
\& + A BcdE\:Fg
\& + \-\- verbose : LATIN SMALL LETTER C, LATIN SMALL LETTER D, ZERO WIDTH SPACE
.Ve
.Sp
With \-Uu0v2:
.Sp
.Vb 5
\& 1,1c1,1
\& \- A ↱ ↰B↱CD↰E↱ ↰Fg
\& \- \-\- verbose : SPACE, LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER D, SPACE
\& + A B↱cd↰E↱\:↰Fg
\& + \-\- verbose : LATIN SMALL LETTER C, LATIN SMALL LETTER D, ZERO WIDTH SPACE
.Ve
.Sp
With \-Uu0v3:
.Sp
.Vb 5
\& 1,1c1,1
\& \- A ↱ ↰B↱CD↰E↱ ↰Fg
\& \- \-\- verbose : SPACE (U+000020), LATIN CAPITAL LETTER C (U+000043), LATIN CAPITAL LETTER D (U+000044), SPACE (U+000020)
\& + A B↱cd↰E↱\:↰Fg
\& + \-\- verbose : LATIN SMALL LETTER C (U+000063), LATIN SMALL LETTER D (U+000064), ZERO WIDTH SPACE (U+00200B)
.Ve
.Sp
With \-Uu0v2 \-\-ascii:
.Sp
.Vb 5
\& 1,1c1,1
\& \- A > <B>CD<E> <Fg
\& \- \-\- verbose : SPACE, LATIN CAPITAL LETTER C, LATIN CAPITAL LETTER D, SPACE
\& + A B>cd<E>\:<Fg
\& + \-\- verbose : LATIN SMALL LETTER C, LATIN SMALL LETTER D, ZERO WIDTH SPACE
.Ve
.Sp
the word "verbose" and the character markers will be displayed using the
\&\f(CW\*(C`verbose\*(C'\fR color. The characters used for the markers can be defined in your
configuration file as \f(CW\*(C`chr_cml\*(C'\fR (the character used as marker on the left)
and \f(CW\*(C`chr_cmr\*(C'\fR (the character used as marker on the right).
.IP "\-\-markers \-m" 2
.IX Item "--markers -m"
Use markers under each changed character in change\-chunks.
.Sp
\&\f(CW\*(C`\-\-markers\*(C'\fR is especially useful if the terminal does not support colors, or
if you want to copy/paste the output to (ASCII) mail. See also \f(CW\*(C`\-\-ascii\*(C'\fR. The
markers will have the same color as added or deleted text.
.Sp
This will look like (with unified diff):
.Sp
.Vb 5
\& 5,5c5,5
\& \-Sat Dec 18 07:08:33 1998,I.O.D.U.,,756194433,1442539
\& \- ▼ ▼
\& +Sat Dec 18 07:00:33 1993,I.O.D.U.,,756194433,1442539
\& + ▲ ▲
.Ve
.Sp
The characters used for the markers can be defined in your configuration file
as \f(CW\*(C`chr_old\*(C'\fR (the character used as marker under removed characters) and
\&\f(CW\*(C`chr_new\*(C'\fR (the character used as marker under added characters).
.Sp
If \f(CW\*(C`\-\-ellipsis\*(C'\fR is also in effect and either the \f(CW\*(C`chr_eli\*(C'\fR is longer than
one character or \f(CW\*(C`\-\-verbose\*(C'\fR level is over 2, this option is automatically
disabled.
.IP "\-\-ascii \-a" 2
.IX Item "--ascii -a"
Use (colored) ASCII indicators instead of Unicode. The default indicators are
Unicode characters that stand out better. The markers will have the same color
as added or deleted text.
.Sp
For the vertical markers (\f(CW\*(C`\-m\*(C'\fR) that would look like:
.Sp
.Vb 5
\& 5,5c5,5
\& \-Sat Dec 18 07:08:33 1998,I.O.D.U.,,756194433,1442539
\& \- ^ ^
\& +Sat Dec 18 07:00:33 1993,I.O.D.U.,,756194433,1442539
\& + ^ ^
.Ve
.Sp
For the positional indicators, I did consider using U+034e (COMBINING UPWARDS
ARROW BELOW), but as most terminals are probably unable to show it due to line
height changes, I did not pursue the idea.
.IP "\-\-pink \-p" 2
.IX Item "--pink -p"
Change the default \f(CW\*(C`red\*(C'\fR for deleted text to the color closest to pink that
is supported by Term::ANSIColor: \f(CW\*(C`magenta\*(C'\fR.
.IP "\-\-reverse \-r" 2
.IX Item "--reverse -r"
Reverse/invert the foreground and background for the colored indicators.
.Sp
If the foreground color has \f(CW\*(C`bold\*(C'\fR, it will be stripped from the new background
color.
.IP "\-\-swap \-s" 2
.IX Item "--swap -s"
Swap the colors for new and old.
.IP \-\-list\-colors 2
.IX Item "--list-colors"
List available colors and exit.
.IP \-\-no\-colors 2
.IX Item "--no-colors"
Disable all colors. Useful for redirecting the diff output to a file that is to
be included in documentation.
.Sp
This is the default if the environment variable \f(CW$NO_COLOR\fR has a true value or
if the environment variable \f(CW$CLICOLOR\fR is set to a false value. If set,
\&\f(CW$CLICOLOR_FORCE\fR will overrule the default of \f(CW$NO_COLOR\fR.
.IP \-\-old=color 2
.IX Item "--old=color"
Define the foreground color for deleted text.
.IP \-\-new=color 2
.IX Item "--new=color"
Define the foreground color for added text.
.IP \-\-bg=color 2
.IX Item "--bg=color"
Define the background color for changed text.
.IP "\-\-index \-\-idx \-I" 2
.IX Item "--index --idx -I"
Prefix position indicators with an index.
.Sp
.Vb 3
\& [001] 5,5c5,5
\& \-Sat Dec 18 07:08:33 1998,I.O.D.U.,,756194433,1442539
\& +Sat Dec 18 07:00:33 1993,I.O.D.U.,,756194433,1442539
.Ve
.Sp
If a positive number is passed (\f(CW\*(C`\-\-index=4\*(C'\fR or \f(CW\*(C`\-I 4\*(C'\fR), display just the
chunk with that index, using the \f(CW\*(C`verbose\*(C'\fR color:
.Sp
This is useful in combination with \f(CW\*(C`\-\-verbose\*(C'\fR.
.IP "\-\-threshold=2 \-t 2" 2
.IX Item "--threshold=2 -t 2"
Defines the number of lines a change block may differ before the fall\-back of
horizontal diff to vertical diff.
.Sp
If a chunk describes a change, and the number of lines in the original block
has fewer or more lines than the new block and that difference exceeds this
threshold, \f(CW\*(C`ccdiff\*(C'\fR will fall\-back to vertical diff.
.IP "\-\-heuristics=n \-h n" 2
.IX Item "--heuristics=n -h n"
Defines the percentage of character\-changes a change block may differ before
the fall\-back of horizontal diff to vertical diff.
.Sp
This percentage is calculated as \f(CW\*(C`(characters removed + characters added) /
(2 * characters unchanged))\*(C'\fR.
.IP "\-\-ellipsis=n \-e n" 2
.IX Item "--ellipsis=n -e n"
Defines the number of characters to keep on each side of a horizontal\-equal
segment. The default is \f(CW0\fR, meaning do not compress.
.Sp
If set to a positive number, and the length of a segment of equal characters
inside a horizontal diff is longer than twice this value, the middle part is
replaced with \f(CW\*(C`┈ U02508 \eN{BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL}\*(C'\fR
(instead of … U02026, as HORIZONTAL ELLIPSIS does not stand out enough).
.Sp
With \f(CW\*(C`\-u0me3\*(C'\fR that would be like
.Sp
.Vb 5
\& 5,5c5,5
\& \-Sat┈07:08:33┈ 1998,I.┈539
\& \- ▼ ▼
\& +Sat┈07:00:33┈ 1993,I.┈539
\& + ▲ ▲
.Ve
.Sp
With \f(CW\*(C`\-u0e3 \-v2\*(C'\fR like
.Sp
.Vb 5
\& 5,5c5,5
\& \-Sat↤9↦07:0↱0↰:33 199↱3↰,I.↤23↦539
\& \- \-\- verbose : DIGIT ZERO, DIGIT THREE
\& +Sat↤9↦07:0↱8↰:33 199↱8↰,I.↤23↦539
\& + \-\- verbose : DIGIT EIGHT, DIGIT EIGHT
.Ve
.Sp
The text used for the replaced text can be defined in your configuration file
as \f(CW\*(C`chr_eli\*(C'\fR and/or \f(CW\*(C`chr_eli_v\*(C'\fR.
.IP "\-\-ignore\-case \-i" 2
.IX Item "--ignore-case -i"
Ignore case on comparison.
.IP "\-\-ignore\-all\-space \-w" 2
.IX Item "--ignore-all-space -w"
Ignore all white\-space changes. This will set all options \f(CW\*(C`\-b\*(C'\fR, \f(CW\*(C`\-Z\*(C'\fR, \f(CW\*(C`\-E\*(C'\fR,
and \f(CW\*(C`\-B\*(C'\fR.
.IP "\-\-ignore\-trailing\-space \-Z" 2
.IX Item "--ignore-trailing-space -Z"
Ignore changes in trailing white\-space (tabs and spaces).
.IP "\-\-ignore\-ws|ignore\-space\-change \-b" 2
.IX Item "--ignore-ws|ignore-space-change -b"
Ignore changes in horizontal white\-space (tabs and spaces). This does not
include white\-space changes that split non\-white\-space or remove white\-space
between two non\-white\-space elements.
.IP "\-\-ignore\-tab\-expansion \-E" 2
.IX Item "--ignore-tab-expansion -E"
NYI
.IP "\-\-ignore\-blank\-lines \-B" 2
.IX Item "--ignore-blank-lines -B"
\&\fBJust Partly Implemented\fR (WIP)
.SS "Configuration files"
.IX Subsection "Configuration files"
In order to be able to overrule the defaults set in \f(CW\*(C`ccdiff\*(C'\fR, one can set
options specific for this login. The following option files are looked for
in this order:
.PP
.Vb 3
\& \- $HOME/ccdiff.rc
\& \- $HOME/.ccdiffrc
\& \- $HOME/.config/ccdiff
.Ve
.PP
and evaluated in that order. Any options specified in a file later in that
chain will overwrite previously set options.
.PP
Option files are only read and evaluated if they are not empty and not writable
by others than the owner.
.PP
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 \f(CW\*(C`=\*(C'\fR or
a \f(CW\*(C`:\*(C'\fR, followed by optional white\-space and the values, the value is assigned
to the option. The values \f(CW\*(C`no\*(C'\fR and \f(CW\*(C`false\*(C'\fR (case insensitive) are aliases
for \f(CW0\fR. The values \f(CW\*(C`yes\*(C'\fR and \f(CW\*(C`true\*(C'\fR are aliases to \f(CW\-1\fR (\f(CW\-1\fR being a
true value).
.PP
Between parens is the corresponding command\-line option.
.IP "unified (\-u)" 2
.IX Item "unified (-u)"
If you prefer unified\-diff over old\-style diff by default, set this to the
desired number of context lines:
.Sp
.Vb 1
\& unified : 3
.Ve
.Sp
The default is undefined
.IP "markers (\-m)" 2
.IX Item "markers (-m)"
.Vb 1
\& markers : false
.Ve
.Sp
Defines if markers should be used under changed characters. The default is to
use colors only. The \f(CW\*(C`\-m\*(C'\fR command line option will toggle the option when set
from a configuration file.
.IP "ascii (\-a)" 2
.IX Item "ascii (-a)"
.Vb 1
\& ascii : false
.Ve
.Sp
Defines to use ASCII markers instead of Unicode markers. The default is to use
Unicode markers.
.IP "reverse (\-r)" 2
.IX Item "reverse (-r)"
.Vb 1
\& reverse : false
.Ve
.Sp
Defines if changes are displayed as foreground\-color over background\-color
or background\-color over foreground\-color. The default is \f(CW\*(C`false\*(C'\fR, so it will
color the changes with the appropriate color (\f(CW\*(C`new\*(C'\fR or \f(CW\*(C`old\*(C'\fR) over the
default background color.
.IP "swap (\-s)" 2
.IX Item "swap (-s)"
.Vb 1
\& swap : false
.Ve
.Sp
Swap the colors for new and old.
.IP "new (\-\-new)" 2
.IX Item "new (--new)"
.Vb 1
\& new : green
.Ve
.Sp
Defines the color to be used for added text. The default is \f(CW\*(C`green\*(C'\fR.
.Sp
The color \f(CW\*(C`none\*(C'\fR is also accepted and disables this color.
.Sp
Any color accepted by Term::ANSIColor is allowed. Any other color will
result in a warning. This option can include \f(CW\*(C`bold\*(C'\fR either as prefix or
as suffix.
.Sp
This option may also be specified as
.Sp
.Vb 4
\& new\-color
\& new_color
\& new\-colour
\& new_colour
.Ve
.IP "old (\-\-old)" 2
.IX Item "old (--old)"
.Vb 1
\& old : red
.Ve
.Sp
Defines the color to be used for deleted text. The default is \f(CW\*(C`red\*(C'\fR.
.Sp
The color \f(CW\*(C`none\*(C'\fR is also accepted and disables this color.
.Sp
Any color accepted by Term::ANSIColor is allowed. Any other color will
result in a warning. This option can include \f(CW\*(C`bold\*(C'\fR either as prefix or
as suffix.
.Sp
This option may also be specified as
.Sp
.Vb 4
\& old\-color
\& old_color
\& old\-colour
\& old_colour
.Ve
.IP "bg (\-\-bg)" 2
.IX Item "bg (--bg)"
.Vb 1
\& bg : white
.Ve
.Sp
Defines the color to be used as background for changed text. The default is
\&\f(CW\*(C`white\*(C'\fR.
.Sp
The color \f(CW\*(C`none\*(C'\fR is also accepted and disables this color.
.Sp
Any color accepted by Term::ANSIColor is allowed. Any other color will
result in a warning. The \f(CW\*(C`bold\*(C'\fR attribute is not allowed.
.Sp
This option may also be specified as
.Sp
.Vb 9
\& bg\-color
\& bg_color
\& bg\-colour
\& bg_colour
\& background
\& background\-color
\& background_color
\& background\-colour
\& background_colour
.Ve
.IP "header (\-H \-\-header \-\-HC=color \-\-header\-color=color)" 2
.IX Item "header (-H --header --HC=color --header-color=color)"
.Vb 2
\& header : 1
\& header : blue_on_white
.Ve
.Sp
Defines if a header is displayed above the diff (default is 1), supported
colors are allowed.
.Sp
If the value is a valid supported color, it will show the header in that
color scheme. To disable the header set it to \f(CW0\fR in the RC file or use
\&\f(CW\*(C`\-\-no\-header\*(C'\fR as a command line argument.
.IP verbose 2
.IX Item "verbose"
.Vb 1
\& verbose : cyan
.Ve
.Sp
Defines the color to be used as color for the verbose tag. The default is
\&\f(CW\*(C`cyan\*(C'\fR. This color will only be used under \f(CW\*(C`\-\-verbose\*(C'\fR.
.Sp
The color \f(CW\*(C`none\*(C'\fR is also accepted and disables this color.
.Sp
Any color accepted by Term::ANSIColor is allowed. Any other color will
result in a warning.
.Sp
This option may also be specified as
.Sp
.Vb 4
\& verbose\-color
\& verbose_color
\& verbose\-colour
\& verbose_colour
.Ve
.IP "utf8 (\-U)" 2
.IX Item "utf8 (-U)"
.Vb 1
\& utf8 : yes
.Ve
.Sp
Defines whether all I/O is to be interpreted as UTF\-8. The default is \f(CW\*(C`no\*(C'\fR.
.Sp
This option may also be specified as
.Sp
.Vb 3
\& unicode
\& utf
\& utf\-8
.Ve
.IP "index (\-I)" 2
.IX Item "index (-I)"
.Vb 1
\& index : no
.Ve
.Sp
Defines if the position indication for a change chunk is prefixed with an
index number. The default is \f(CW\*(C`no\*(C'\fR. The index is 1\-based.
.Sp
Without this option, the position indication would be like
.Sp
.Vb 3
\& 5,5c5,5
\& 19,19d18
\& 42a42,42
.Ve
.Sp
with this option, it would be
.Sp
.Vb 3
\& [001] 5,5c5,5
\& [002] 19,19d18
\& [005] 42a42,42
.Ve
.Sp
When this option contains a positive integer, \f(CW\*(C`ccdiff\*(C'\fR will only show the
diff chunk with that index.
.IP emacs 2
.IX Item "emacs"
.Vb 1
\& emacs : no
.Ve
.Sp
If this option is yes/true, calling \f(CW\*(C`ccdiff\*(C'\fR with just one single argument,
and that argument being an existing file, the arguments will act as
.Sp
.Vb 1
\& $ ccdiff file~ file
.Ve
.Sp
if file~ exists.
.IP "threshold (\-t)" 2
.IX Item "threshold (-t)"
.Vb 1
\& threshold : 2
.Ve
.Sp
Defines the number of lines a change block may differ before the fall\-back of
horizontal diff to vertical diff.
.IP "heuristics (\-h)" 2
.IX Item "heuristics (-h)"
.Vb 1
\& heuristics : 40
.Ve
.Sp
Defines the percentage of character\-changes a change block may differ before
the fall\-back of horizontal diff to vertical diff. The default is undefined,
meaning no fallback based on heuristics.
.IP "ellipsis (\-e)" 2
.IX Item "ellipsis (-e)"
.Vb 1
\& ellipsis : 0
.Ve
.Sp
Defines the number of characters to keep on each side of a horizontal\-equal
segment. The default is \f(CW0\fR, meaning to not compress. See also \f(CW\*(C`chr_eli\*(C'\fR.
.IP chr_old 2
.IX Item "chr_old"
.Vb 1
\& chr_old : U+25BC
.Ve
.Sp
Defines the character used to indicate the position of removed text on the
line below the text when option \f(CW\*(C`\-m\*(C'\fR is in effect.
.IP chr_new 2
.IX Item "chr_new"
.Vb 1
\& chr_new : U+25B2
.Ve
.Sp
Defines the character used to indicate the position of added text on the
line below the text when option \f(CW\*(C`\-m\*(C'\fR is in effect.
.IP chr_cml 2
.IX Item "chr_cml"
.Vb 1
\& chr_cml : U+21B1
.Ve
.Sp
Defines the character used to indicate the starting position of changed text
in a line when verbose level is 3 and up.
.IP chr_cmr 2
.IX Item "chr_cmr"
.Vb 1
\& chr_cmr : U+21B0
.Ve
.Sp
Defines the character used to indicate the ending position of changed text
in a line when verbose level is 3 and up.
.IP chr_eli 2
.IX Item "chr_eli"
.Vb 1
\& chr_eli : U+2508
.Ve
.Sp
Defines the character used to indicate omitted text in large unchanged text
when \f(CW\*(C`\-\-ellipsis\*(C'\fR/\f(CW\*(C`\-e\*(C'\fR is in effect.
.Sp
This character is not equally well visible on all terminals or in all fonts,
so you might want to change it to something that stands out better in your
environment. Possible suggestions:
.Sp
.Vb 10
\& … U+2026 HORIZONTAL ELLIPSIS
\& ‴ U+2034 TRIPLE PRIME
\& ‷ U+2037 REVERSED TRIPLE PRIME
\& ↔ U+2194 LEFT RIGHT ARROW
\& ↭ U+21ad LEFT RIGHT WAVE ARROW
\& ↮ U+21ae LEFT RIGHT ARROW WITH STROKE
\& ↹ U+21b9 LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR
\& ⇄ U+21c4 RIGHTWARDS ARROW OVER LEFTWARDS ARROW
\& ⇆ U+21c6 LEFTWARDS ARROW OVER RIGHTWARDS ARROW
\& ⇎ U+21ce LEFT RIGHT DOUBLE ARROW WITH STROKE
\& ⇔ U+21d4 LEFT RIGHT DOUBLE ARROW
\& ⇹ U+21f9 LEFT RIGHT ARROW WITH VERTICAL STROKE
\& ⇼ U+21fc LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE
\& ⇿ U+21ff LEFT RIGHT OPEN\-HEADED ARROW
\& ≋ U+224b TRIPLE TILDE
\& ┄ U+2504 BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL
\& ┅ U+2505 BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL
\& ┈ U+2508 BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL
\& ┉ U+2509 BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL
\& ⧻ U+29fb TRIPLE PLUS
\& ⬌ U+2b0c LEFT RIGHT BLACK ARROW
.Ve
.IP chr_eli_v 2
.IX Item "chr_eli_v"
.Vb 1
\& chr_eli_v : U+21A4U+21A6
.Ve
.Sp
When using \f(CW\*(C`\-\-ellipsis\*(C'\fR with \f(CW\*(C`\-\-verbose\*(C'\fR level 2 or up, the single character
indicator will be replaced with this character. If it is 2 characters wide, the
length of the compressed part is put between the characters.
.Sp
A suggested alternative might be U+21E4U+21E5
.IP iwbZusePP 2
.IX Item "iwbZusePP"
As Algorithm::Diff::XS is fast but is not 100% drop\-in compliant with
Algorithm::Diff and options \f(CW\*(C`\-i\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, \f(CW\*(C`\-b\*(C'\fR, and \f(CW\*(C`\-Z\*(C'\fR are likely to
not work in the \f(CW\*(C`XS\*(C'\fR version, this option allows automatic switching to
the slower version if any of these options is selected.
.SH "Git integration"
.IX Header "Git integration"
You can use ccdiff to show diffs in git. It may work like this:
.PP
.Vb 9
\& $ git config \-\-global diff.tool ccdiff
\& $ git config \-\-global difftool.prompt false
\& $ git config \-\-global difftool.ccdiff.cmd \*(Aqccdiff \-\-utf\-8 \-u \-r $LOCAL $REMOTE\*(Aq
\& $ git difftool SHA~..SHA
\& $ wget https://github.com/Tux/App\-ccdiff/raw/master/Files/git\-ccdiff \e
\& \-O ~/bin/git\-ccdiff
\& $ perl \-pi \-e \*(Aqs{/pro/bin/perl}{/usr/bin/env perl}\*(Aq ~/bin/git\-ccdiff
\& $ chmod 755 ~/bin/git\-ccdiff
\& $ git ccdiff SHA
.Ve
.PP
Of course you can use \f(CW\*(C`curl\*(C'\fR instead of \f(CW\*(C`wget\*(C'\fR and you can choose your own
(fixed) path to \f(CW\*(C`perl\*(C'\fR instead of using \f(CW\*(C`/usr/bin/env\*(C'\fR.
.PP
From then on you can do
.PP
.Vb 2
\& $ git ccdiff
\& $ git ccdiff 5c5a39f2
.Ve
.SH CAVEATS
.IX Header "CAVEATS"
Due to the implementation, where both sides of the comparison are completely
kept in memory, this tool might not be able to deal with (very) large datasets.
.SS Speed
.IX Subsection "Speed"
There are situations where Algorithm::Diff takes considerably more time
compared to e.g. GNU diff. Installing Algorithm::Diff::XS will make
\&\f(CW\*(C`ccdiff\*(C'\fR a lot faster. \f(CW\*(C`ccdiff\*(C'\fR will choose Algorithm::Diff::XS if
available.
.PP
Note however that options like \f(CW\*(C`\-i\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, \f(CW\*(C`\-b\*(C'\fR, and \f(CW\*(C`\-Z\*(C'\fR are likely to
be a no\-op in Algorithm::Diff::XS, as that has not been implemented and
it is rather unlikely it will be. Choose \f(CW\*(C`\-\-dc=pp\*(C'\fR then. If you want this
switch always, set \f(CW\*(C`iwbZusePP = 1\*(C'\fR in one of your "Configuration files".
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Algorithm::Diff::XS, Algorithm::Diff, Text::Diff
.SH AUTHOR
.IX Header "AUTHOR"
H.Merijn Brand
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
.Vb 1
\& Copyright (C) 2018\-2025 H.Merijn Brand. All rights reserved.
.Ve
.PP
This library is free software; you can redistribute and/or modify it under
the same terms as The Artistic License 2.0.