#!/usr/bin/env perl

require App::NDTools::NDDiff;

App::NDTools::NDDiff->new(@ARGV)->exec();

__END__

=head1 NAME

nddiff - diff tool for nested data structures

=head1 SYNOPSIS

    nddiff [OPTIONS] <file1> <file2> [<file3> ... ]

=head1 DESCRIPTION

Diff for nested data structures with human friendly and machine-readable
output formats.

=head1 OPTIONS

=over 4

=item B<--[no]X>

Where X is an op tag: C<A> (added), C<N> (new value), C<O> (old value), C<R>
(removed) or C<U> (unchanged). All ops enabled by default, except C<U>. See
L<Struct::Diff/DIFF FORMAT> for more info about nested diff format.

=item B<--brief>

Show where differences occured, but don't show what exactly changed.

=item B<--[no]colors>

On/Off colors for diff.

=item B<--ctx-text> [int]

Amount of lines for multiline values context. Default is 3.

=item B<--full-headers>

Print full headers (delta printed by default).

=item B<--grep> E<lt>pathE<gt>

Grep substructures to diff. See path syntax description at
L<https://metacpan.org/pod/Struct::Path::PerlStyle>

=item B<--help|-h>

Print a help message and exit.

=item B<--ifmt> E<lt>JSON|YAMLE<gt>

Force specified input format usage. Will be selected automatically (using
file name extension) if omitted. L<YAML::XS> should be installed for YAML
support.

=item B<--ignore> E<lt>pathE<gt>

Ignore substructure. May be used several times.

=item B<--json>

Use JSON as output diff format.

=item B<--ofmt> E<lt>JSON|YAMLE<gt>

Force specified output format usage. JSON is used by default; L<YAML::XS>
should be installed for YAML support, see L<App::NDTools/LIMITATIONS> for
more info.

=item B<--[no]pretty>

On/Off pretty-print for JSON. Enabled by default.

=item B<--quiet|-q>

Don't show diff, only exit code shows exists diff or not.

=item B<--rules>

Dump diff as rules for L<ndproc>.

=item B<--show>

Visualize diff (JSON/YAML formatted diff expected for argument).

=item B<--verbose|-v> [int]

Increase verbosity, max level is 4.

=item B<--version|-V>

Print version and exit.

=back

=head1 EXAMPLES

Human-friendly diff:

    nddiff a.json b.json

Machine-readable diff:

    nddiff --json a.json b.json

Same as above, but without added items:

    nddiff --noA --json a.json b.json

=head1 EXIT STATUS

 0   No errors, no diff.
 1   Generic error code.
 2   I/O Error.
 4   Path related errors.
 8   Difference found.

=head1 BUGS

Report bugs to L<https://github.com/mr-mixas/NDTools/issues>

=head1 SEE ALSO

L<ndpatch>, L<ndproc>, L<ndquery>

L<App::NDTools::NDDiff>, L<Struct::Diff>

=head1 LICENSE AND COPYRIGHT

Copyright 2016-2018 Michael Samoglyadov C<< <mixas at cpan.org> >>.

This program is free software; you can redistribute it and/or modify it
under the terms of GNU General Public License 3 or later versions.
