Skip to content

Latest commit

 

History

History
executable file
·
144 lines (77 loc) · 2.69 KB

ndquery

File metadata and controls

executable file
·
144 lines (77 loc) · 2.69 KB

NAME

ndquery - query tool for nested data structures

SYNOPSIS

ndquery [OPTIONS] <arguments>

DESCRIPTION

Get specified by path parts from nested data structure

OPTIONS

--[no]colors

On/Off colors in --list mode.

--delete|--ignore <path>

Delete substructure. May be used several times.

--depth|-d <int>

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

--grep <path>

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

--help|-h

Print a help message and exit.

--ifmt <JSON|YAML>

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

--keys

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

--list|-l

List structure's paths.

--md5

Calculate MD5 sum for structure.

--ofmt <JSON|YAML>

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

--path|-p <path>

Path in the structure to deal with.

--[no]pretty

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

--raw-output

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

--replace

Replace original files by query result.

--[no]strict

Fail if unexisted path specified. Enabled by default.

--values|--vals

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

--verbose|-v [int]

Increase verbosity, max level is 4.

--version|-V

Print version and exit.

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

EXIT STATUS

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

BUGS

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

SEE ALSO

nddiff, ndpatch, ndproc

App::NDTools::NDQuery

LICENSE AND COPYRIGHT

Copyright 2016-2019 Michael Samoglyadov <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.