jp
jp copied to clipboard
Add jpp which is an extended superset of the jp command
This PR contains the master branch of https://github.com/pipebus/jpp, which adds jpp, an extended superset of the jp command:
An extended superset of the jp CLI for JMESPath
Usage:
jpp [<options>] [expression] [flags]
Flags:
-a, --accumulate Accumulate all output objects into a single recursively merged output object.
--ast Only print the AST of the parsed expression. Do not rely on this output, only useful for debugging purposes.
-c, --compact Produce compact JSON output that omits nonessential whitespace.
-e, --expr-file string Read JMESPath expression from the specified file.
-f, --filename string Read input JSON from a file instead of stdin.
-h, --help show usage and exit
-R, --raw-input Read raw string input and box it as JSON strings.
-r, --raw-output If the final result is a string, it will be printed without quotes (an alias for --unquoted).
-s, --slurp Read one or more input JSON objects into an array and apply the JMESPath expression to the resulting array.
-u, --unbox If the final result is a list, unbox it into a stream of output objects that is suitable for consumption by --slurp mode.
--unquoted If the final result is a string, it will be printed without quotes.
This command has everything that I need to replace jq in my shell scripts.
I've also added a compatible python implementation of jpp to the jpipe package, so a python implementation can be installed via pip install jpipe:
https://github.com/pipebus/jpipe/compare/4ca9dd3bdf36cf16b1a10a670da8f3eafd7d3388%5E...8acf6dcfae4cec9f9943ceb660aa5537fe8e4aa2
The jpp command is now available on Gentoo Linux via either the app-misc/jp or app-misc/jpipe packages.
I've submitted the python implementation for inclusion in https://github.com/jmespath/jmespath.py/pull/224.
Thanks! This is awesome. I'd like to take some time to go through this in more detail, but looking over most of these arguments, they seem like they'd be great additions to jp.
Closing out old PR. Happy to discuss features to merge back into the jp executable.