App-sdif

 view release on metacpan or  search on metacpan

script/cdif  view on Meta::CPAN

	--style=diff        print --lxl output in diff style
	--version           show version


=head1 DESCRIPTION

B<cdif> is a post-processor of the Unix diff command.  It highlights
deleted, changed and added words based on word context (B<--unit=word>
by default).  If you want to compare text character-by-character, use
option B<--unit=char>.  Option B<--unit=mecab> tells to use external
B<mecab> command as a tokenizer for Japanese text.

If single or no file is specified, B<cdif> reads that file or STDIN as
an output from diff command.  In addition to normal diff, context
diff, and unified (combined) diff, the L<git(1)>-compatible conflict
marker format is supported as input format.

Lines that don't look like diff output are simply ignored and
printed.

=head2 STARTUP and MODULE

B<cdif> utilizes Perl L<Getopt::EX> module, and reads I<~/.cdifrc>
file if available when starting up.  You can define original and
default option there.  The next line enables B<--mecab> option and adds
crossed-out effect for deleted words.

    option default --mecab --cm DELETE=+X

Modules under B<App::cdif> can be loaded by B<-M> option without
prefix.  The next command loads B<App::cdif::colors> module.

    $ cdif -Mcolors

You can also define options in module file.  Read `perldoc
Getopt::EX::Module` for detail.

=head2 COLOR

Each line is displayed in different colors.  Each text segment has
own labels, and color for them can be specified by B<--colormap>
option.  Read `perldoc Getopt::EX::Colormap` for detail.

Standard module B<-Mcolors> is loaded by default, and defines several
color maps for light and dark screen.  If you want to use CMY colors in
dark screen, place next line in your F<~/.cdifrc>.

    option default --dark-cmy

Option B<--autocolor> is defined in B<default> module to call
L<Getopt::EX::termcolor> module.  It sets B<--light> or B<--dark>
option according to the brightness of the terminal screen.  You can
set preferred color in your F<~/.cdifrc> like:

    option --light --cmy
    option --dark  --dark-cmy

Automatic setting is done by L<Getopt::EX::termcolor> module and it
works with macOS Terminal.app and iTerm.app, and other XTerm
compatible terminals.  This module accepts environment variable
L<TERM_BGCOLOR> as a terminal background color.  For example, use
C<000> or C<#000000> for black and C<555> or C<#FFFFFF> for white.

Option B<--autocolor> is set by default, so override it to do nothing
to disable.

    option --autocolor --nop

=head2 EXIT STATUS

B<cdif> always exits with status zero unless an error occurs.

=head1 OPTIONS

=over 7

=item B<->[B<cCuUibwtT>]

Almost same as B<diff> command.

=begin deprecated

=item B<--rcs>, B<-r>I<rev>, B<-q>

Use rcsdiff instead of normal diff.  Option B<--rcs> is not required
when B<-r>I<rev> is supplied.

=end deprecated

=item B<-->B<unit>=[C<word>,C<letter>,C<char>,C<mecab>,C<0>,C<>]

=item B<-->B<by>=[C<word>,C<letter>,C<char>,C<mecab>,C<0>,C<>]

Specify the comparing unit.  Default is I<word> and compare each line
word-by-word.  Specify C<char> if you want to compare them
character-by-character.  Unit C<letter> is almost same as C<word> but
does not include underscore.

When C<mecab> is given as an unit, B<mecab> command is called as a
tokenizer for non-ASCII text.  ASCII text is compared word-by-word.
External B<mecab> command has to be installed.

If you give empty string like C<--unit=>, or C<0>, B<cdif> does not
compare text in any way.  You'll still get colorization effect.

=item B<--mecab>

Shortcut for B<--unit=mecab>.

=item B<--diff>=I<command>

Specify the diff command to use.

=item B<--subdiff>=I<command>

Specify the backend diff command to get word differences.  Accept
normal and unified diff format.

If you want to use B<git diff> command, don't forget to set I<-U0>
option.



( run in 3.948 seconds using v1.01-cache-2.11-cpan-f56aa216473 )