#!/usr/bin/env perl

require App::NDTools::NDQuery;

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

__END__

=head1 NAME

ndquery - get desired parts from nested data structure

=head1 SYNOPSIS

    ndquery [OPTIONS] <arguments>

=head1 DESCRIPTION

Get specified by path parts from nested data structure

=head1 OPTIONS

=over 4

=item B<--[no]colors>

On/Off colors in --list mode.

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

Delete substructure. May be used several times.

=item B<--depth|-d> E<lt>intE<gt>

Combined with B<--list> allows to define how much levels must be listed.

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

Grep specified by path elements from structure. May be used several times.

=item B<--help|-h>

Print a help message and exit.

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

Force specified input format usage. Automatically choosed (using file
extension) if omitted.

=item B<--keys>

List keys for hash maps and indexes for arrays, others printed as is.

=item B<--list|-l>

List structure's paths.

=item B<--md5>

Calculate MD5 sum for structure.

=item B<--path|-p> E<lt>pathE<gt>

Path in the structure to deal with.

=item B<--[no]pretty>

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

=item B<--raw-output>

Dont't format result simple things (strings/numbers) - dump them as is.

=item B<--replace>

Replace original files by query result.

=item B<--[no]strict>

Fail if unexisted path specified. Enabled by default.

=item B<--values|--vals>

Values will be printed if combined with --list opt.

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

Increase verbosity, max level - 4.

=item B<--version|-V>

Print version and exit.

=back

=head1 EXAMPLES

Show as pretty printed canonical JSON:

    ndquery struct.json

Get specified path from document:

    ndquery --path '{some}{path}[2]' struct.json

List subpaths:

    ndquery --list --path '{some}{path}[2]' struct.json

Checksum for substructures:

    ndquery --md5 --path '{some}{path}' struct.json another.json

=head1 EXIT STATUS

 0   No errors occured.
 1   Generic error code.
 2   I/O Error.
 4   Path related errors.
 8   Path does not exists.

=head1 BUGS

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

=head1 SEE ALSO

L<nddiff>, L<ndpatch>, L<ndproc>

L<App::NDTools::NDQuery>

=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.
