App-sdif

 view release on metacpan or  search on metacpan

script/sdif  view on Meta::CPAN

      wrapped  ..     folded
    4 same          3 same
                +   4 added

It also reads and formats the output from B<diff> command from
standard input.  Besides normal diff output, context diff B<-c> and
unified diff B<-u> output will be handled properly.  Combined diff and
conflict marker styles are also supported, but currently limited up to
three files.

The current implementation also supports C<#ifdef> and markdown custom
container (using seven colons) formats on an experimental basis.  This
is to support the multilingual format generated by the
L<App::Greple::xlate> module.

If you want to just show multiple files side-by-side in parallel, and
do not concern about the difference of them, use L<App::ansicolumn>
command.

=head2 STARTUP and MODULE

B<sdif> utilizes Perl L<Getopt::EX> module, and reads C<~/.sdifrc>
file if available when starting up.  You can define original and
default option there.  To show the line number always, define like
this:

    option default -n

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

    $ sdif -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 by default.  Use
B<--no-color> option to disable it.  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<~/.sdifrc>.

    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<~/.sdifrc> 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 in a form of
C<#FFFFFF>.

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

    option --autocolor --nop

=head2 WORD DIFFERENCE

While B<sdif> doesn't care about the contents of each modified line,
it can read the output from B<cdif> command which shows the word
context differences of each line.  Use B<cdif> command with option
B<--sdif> to set the appropriate options for B<sdif>.  Set B<--no-cc>,
B<--no-mc> options at least when invoking B<cdif> manually.  Option
B<--no-tc> is preferable because text color can be handled by B<sdif>.

From version 4.1.0, option B<--cdif> is set by default, so use
B<--no-cdif> option to disable it.  Option B<--unit> (default word)
will be passed through to B<cdif>.  Other B<cdif> options can be
specified by B<--cdifopts>.

=head2 EXIT STATUS

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

=head1 OPTIONS

=over 7

=item B<--width>=I<width>, B<-W> I<width>

Use width as a width of output listing.  Default width is 80.  If the
standard error is assigned to a terminal, the width is taken from it
if possible.

=item B<--margin>=I<column>

=item B<--runin>=I<column>

=item B<--runout>=I<column>

Set the number of margin column.  Margin columns are left blank at the
end of each line.  This option implicitly declares line break control,
which allows to run-in and run-out prohibited characters at the
head-and-end of line.  Margin columns are used for run-in/run-out
columns unless they are given explicitly.  See `perldoc
Text::ANSI::Fold` for detail.

=item B<-n>, B<-->[B<no->]B<number>

Print line number on each line.
Default false.

=item B<-->[B<no->]B<command>

Print diff command control lines.
Default true.

=item B<-->[B<no->]B<filename>



( run in 0.648 second using v1.01-cache-2.11-cpan-f56aa216473 )