-
Notifications
You must be signed in to change notification settings - Fork 2
/
nddiff
executable file
·169 lines (93 loc) · 3.4 KB
/
nddiff
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
#!/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.
Ignored when C<--ofmt JSONMERGEPATCH> used.
=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> E<lt>intE<gt>
Amount of lines for multiline values context. Default is 3.
=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. It's just a shortcut for C<--ofmt JSON>.
=item B<--ofmt> E<lt>JSON|JSONMERGEPATCH|JSONPATCH|RULES|TERM|YAMLE<gt>
Force specified output format usage.
=over 8
=item JSON
JSON serialized L<Nested-Diff|https://github.com/mr-mixas/Nested-Diff>
=item JSONMERGEPATCH
JSON Merge Patch L<rfc7396|https://tools.ietf.org/html/rfc7396>
=item JSONPATCH
JSON Patch L<rfc6902|https://tools.ietf.org/html/rfc6902>
=item RULES
JSON serialized rules for L<ndproc>.
=item TERM
Human friendly, colored terminal diff. Used by default.
=item YAML
YAML serialized L<Nested-Diff|https://github.com/mr-mixas/Nested-Diff>.
L<YAML::XS> should be installed for YAML support, see
L<App::NDTools/LIMITATIONS> for more info.
=back
=item B<--[no]pretty>
On/Off pretty-print for JSON serialized and TERM formats. Full headers will be
printed in TERM mode if disabled. 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>. B<Deprecated and will be removed
soon>. C<--ofmt rules> should be used instead.
=item B<--show> E<lt>fileE<gt>
Visualize JSON/YAML formatted
L<Nested Diff|https://github.com/mr-mixas/Nested-Diff>.
=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-2019 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.