What's Changed
The largest addition in this release is support for complex assignments: Previously, the left-hand side of assignments in jaq were restricted to simple path expressions, such as .[], .a. Now, jaq also supports assignments with more general left-hand sides, such as if .. then .. else .. end, recurse(..) and several others. This enables filters such as (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] (taken from the jq manual --- I do not have such strong feelings towards Stephen Dolan's posts ^^).
This release also adds support for several new filters:
inputs,input: These filters make it now possible to process input lazily with state. This effectively makes jaq an impure programming language --- but impurity is restricted to modifying the stream of input values.foreach xs as $x (init; update): This is a powerful tool, in particular in conjunction withinputs. For example,foreach inputs as $x (null; .+$x)builds a cumulative sum of the input elements, lazily...: shorthand forrecurse(.[]?)while,until: thanks to @capezotte
Smaller changes include:
- Configurable color usage via
--color - Escaped characters in strings: It is now possible to write something like
"\"". - Increased compatibility with jq: thanks to @itchyny for finding several places where jq and jaq diverged
- Homebrew installation, thanks to @chenrui333
Full Changelog: v0.7.0...v0.8.0