1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

11 Commits

Author SHA1 Message Date
a83a9e0bc2 Reduce number of msg callback typedefs 2015-02-13 15:58:02 -06:00
0d414471bb Refactor moar: move parts of main.c into libjq
This adds utility functions for reading and parsing files that should be
easy to use by other apps, together with jq_start()/jq_next().
2015-02-13 15:58:02 -06:00
5df20f4954 Add debug builtin
And refactor setup of jv dump flags.
2014-12-27 18:25:34 -06:00
5bfb9781f7 Add Streaming parser (--stream)
Streaming means that outputs are produced as soon as possible.  With the
`foreach` syntax one can write programs which reduce portions of the
streaming parse of a large input (reduce into proper JSON values, for
example), and discard the rest, processing incrementally.

This:

    $ jq -c --stream .

should produce the same output as this:

    $ jq -c '. as $dot | path(..) as $p | $dot | getpath($p) | [$p,.]'

The output of `jq --stream .` should be a sequence of`[[<path>],<leaf>]`
and `[[<path>]]` values.  The latter indicate that the array/object at
that path ended.

Scalars and empty arrays and objects are leaf values for this purpose.

For example, a truncated input produces a path as soon as possible, then
later the error:

    $ printf '[0,\n'|./jq -c --stream .
    [[0],0]
    parse error: Unfinished JSON term at EOF at line 3, column 0
    $
2014-12-26 23:05:56 -06:00
56ae88d9d5 Module search revamp for pkg managers
The search path listed in an import directive can now be an array.  The
top-level search path is appended.  Null and empty strings in the path
terminate any search.  The "." in "." and "./*" is replaced with the
directory containing the file doing the import (for command-line
programs this is the current directory, though that may be a bad idea).

No version numbers or anything of the sort are gratuitously added to the
search paths.

All this makes external package managers possible by allowing
dependencies to be installed local to dependents.
2014-12-24 02:31:51 -06:00
456bafa82f Drop the jq version directory from search path 2014-08-30 00:58:24 -05:00
1ba8c2cfa6 Add module directive, modulemeta builtin
Fix #425.
2014-08-14 03:26:26 -05:00
9f13afa20f Add jq_report_error() function; use it
Put a stop to fprintf(stderr, ...) where we shouldn't.
2014-08-14 03:21:35 -05:00
38b939688a Added library system with -l, -L, and JQ_LIBRARY_PATH
Created util.[ch] to hold common utilities.
2014-07-22 22:51:11 -05:00
eb165459aa Add callback interface for errors
Printing to stderr is not the right answer for a library.
2013-12-04 18:21:41 -06:00
298b2a6033 Add libjq autoconf goo 2013-06-21 11:57:12 -05:00