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
Provenance
- Commit
a17dd32- Tree
53eb4bc- Author
Maximilian Roos <5635139+max-sixty@users.noreply.github.com>- Committer
William Langford <wlangfor@gmail.com>- Parent
6306ac8
1 file changed+13 added−13 removed
modified:docs/content/manual/v1.6/manual.yml+13 added-13 removed
3054 unmodified lines3055 3056 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.3065 3066 The left-hand side can be any general path expression; see `path()`.3067 3068- 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 lines3111 not do this.3112 3113 This example should show the difference between '=' and '|=':3114 3115- Provide input '{"a": {"b": 10}, "b": 20}' to the programs:3115+ Provide input `{"a": {"b": 10}, "b": 20}` to the programs:3116 3117- .a = .b3117+ `.a = .b`3118 3119- .a |= .b3119+ `.a |= .b`3120 3121 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}`.3125 3126- Another example of the difference between '=' and '|=':3126+ Another example of the difference between `=` and `|=`:3127 3128- null|(.a,.b)=range(3)3128+ `null|(.a,.b)=range(3)`3129 3130- 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 while3132 3133- null|(.a,.b)|=range(3)3133+ `null|(.a,.b)|=range(3)`3134 3135- outputs just '{"a":0,"b":0}'.3135+ outputs just `{"a":0,"b":0}`.3136 3137 - title: Complex assignments3138 body: |3139 Lots more things are allowed on the left-hand side of a jq assignment197 unmodified lines