summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Langford <wlangfor@gmail.com>2017-03-31 18:48:05 -0400
committerWilliam Langford <wlangfor@gmail.com>2017-03-31 18:48:05 -0400
commit151b494382e70a21501d23ad39e908476df7d5f7 (patch)
tree96edcd6bd150d69fdad51c839b4f6fdb6c69d2cb
parent12f74b226e85e1ff15924d9f903ae806078b7998 (diff)
Add collect example with pipeline
-rw-r--r--docs/content/3.manual/manual.yml14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml
index 5cde2857..7bf9639d 100644
--- a/docs/content/3.manual/manual.yml
+++ b/docs/content/3.manual/manual.yml
@@ -507,11 +507,11 @@ sections:
As in JSON, `[]` is used to construct arrays, as in
`[1,2,3]`. The elements of the arrays can be any jq
- expression. All of the results produced by all of the
- expressions are collected into one big array. You can use it
- to construct an array out of a known quantity of values (as
- in `[.foo, .bar, .baz]`) or to "collect" all the results of a
- filter into an array (as in `[.items[].name]`)
+ expression, including a pipeline. All of the results produced
+ by all of the expressions are collected into one big array.
+ You can use it to construct an array out of a known quantity
+ of values (as in `[.foo, .bar, .baz]`) or to "collect" all the
+ results of a filter into an array (as in `[.items[].name]`)
Once you understand the "," operator, you can look at jq's array
syntax in a different light: the expression `[1,2,3]` is not using a
@@ -527,6 +527,10 @@ sections:
- program: "[.user, .projects[]]"
input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}'
output: ['["stedolan", "jq", "wikiflow"]']
+ - program: "[ .[] | . * 2]"
+ input: '[1, 2, 3]'
+ output: ['[2, 4, 6]']
+
- title: "Object Construction: `{}`"
body: |