Skip to content
Myr

Add some missing code quoting to the manual

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Maximilian Roos · committed by William Langford · parent 6306ac8 · Browse files · 1 file+13 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−13 removed

  • other:+13 added−13 removed

1 file+13 added−13 removed

modified:docs/content/manual/v1.6/manual.yml+13 added-13 removed
3054 unmodified lines
30553056 entries:3057 - title: "Update-assignment: `|=`"3058 body: |3059 This is the "update" operator '|='. It takes a filter on the3059 This is the "update" operator `|=`. It takes a filter on the3060 right-hand side and works out the new value for the property3061 of `.` being assigned to by running the old value through this3062 expression. For instance, (.foo, .bar) |= .+1 will build an3062 expression. For instance, `(.foo, .bar) |= .+1` will build an3063 object with the "foo" field set to the input's "foo" plus 1,3064 and the "bar" field set to the input's "bar" plus 1.30653066 The left-hand side can be any general path expression; see `path()`.30673068 Note that the left-hand side of '|=' refers to a value in `.`.3068 Note that the left-hand side of `|=` refers to a value in `.`.3069 Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is3070 not a valid or useful path expression in `.`); use `$var |3071 .foo |= . + 1` instead.3072
38 unmodified lines
3111 not do this.31123113 This example should show the difference between '=' and '|=':31143115 Provide input '{"a": {"b": 10}, "b": 20}' to the programs:3115 Provide input `{"a": {"b": 10}, "b": 20}` to the programs:31163117 .a = .b3117 `.a = .b`31183119 .a |= .b3119 `.a |= .b`31203121 The former will set the "a" field of the input to the "b"3122 field of the input, and produce the output {"a": 20, "b": 20}.3122 field of the input, and produce the output `{"a": 20, "b": 20}`.3123 The latter will set the "a" field of the input to the "a"3124 field's "b" field, producing {"a": 10, "b": 20}.3124 field's "b" field, producing `{"a": 10, "b": 20}`.31253126 Another example of the difference between '=' and '|=':3126 Another example of the difference between `=` and `|=`:31273128 null|(.a,.b)=range(3)3128 `null|(.a,.b)=range(3)`31293130 outputs '{"a":0,"b":0}', '{"a":1,"b":1}', and '{"a":2,"b":2}',3130 outputs `{"a":0,"b":0}, {"a":1,"b":1}, {"a":2,"b":2}`,3131 while31323133 null|(.a,.b)|=range(3)3133 `null|(.a,.b)|=range(3)`31343135 outputs just '{"a":0,"b":0}'.3135 outputs just `{"a":0,"b":0}`.31363137 - title: Complex assignments3138 body: |3139 Lots more things are allowed on the left-hand side of a jq assignment
197 unmodified lines