Skip to content
Myr

docs: add simple and nested update-assignment examples (#3664)

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

authored by Hugohong258 · committed by GitHub · parent b904884 · Browse files · 3 files+22 added−0 removed
This commit

State

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

Diff stats

3 files+22 added−0 removed

  • tests:+8 added−0 removed
  • other:+14 added−0 removed

3 files+22 added−0 removed

modified:docs/content/manual/dev/manual.yml+6 added
3570 unmodified lines
3571 one will be used (COMPATIBILITY NOTE: in jq 1.5 and earlier3572 releases, it used to be that only the last one was used).35733574 examples:3575 - program: '.foo |= . + 1'3576 input: '{"foo": 41, "bar": "unchanged"}'3577 output: ['{"foo": 42, "bar": "unchanged"}']3578 - program: '.user.age |= . + 1'3579 input: '{"user": {"name": "alice", "age": 30}, "active": true}'3580 output: ['{"user": {"name": "alice", "age": 31}, "active": true}']3581 - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end'3582 input: '[true,false,[5,true,[true,[false]],false]]'3583 output: ['[1,0,[5,1,[1,[0]],0]]']3584
328 unmodified lines
modified:tests/man.test+8 added
976 unmodified lines
977. as $dot|fromstream($dot|tostream)|.==$dot978[0,[1,{"a":1},{"b":2}]]979true980981.foo |= . + 1982{"foo": 41, "bar": "unchanged"}983{"foo": 42, "bar": "unchanged"}984985.user.age |= . + 1986{"user": {"name": "alice", "age": 30}, "active": true}987{"user": {"name": "alice", "age": 31}, "active": true}988989(..|select(type=="boolean")) |= if . then 1 else 0 end990[true,false,[5,true,[true,[false]],false]]991[1,0,[5,1,[1,[0]],0]]992
22 unmodified lines
modified:jq.1.prebuilt+8 added
3940 unmodified lines
3941.IP "" 43942.3943.nf39443945jq \'\.foo |= \. + 1\'3946 {"foo": 41, "bar": "unchanged"}3947=> {"foo": 42, "bar": "unchanged"}39483949jq \'\.user\.age |= \. + 1\'3950 {"user": {"name": "alice", "age": 30}, "active": true}3951=> {"user": {"name": "alice", "age": 31}, "active": true}39523953jq \'(\.\.|select(type=="boolean")) |= if \. then 1 else 0 end\'3954 [true,false,[5,true,[true,[false]],false]]3955=> [1,0,[5,1,[1,[0]],0]]3956.
382 unmodified lines