Skip to content
Myr

Simplify `pick` example

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

Old pick example included input array in command line, making `input` confusing and redundant.

authored by Thomas Bozeman th026106 · committed by Emanuele Torre · parent 6b5a18f · Browse files · 4 files+5 added−5 removed
This commit

State

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

Diff stats

4 files+5 added−5 removed

  • tests:+1 added−1 removed
  • other:+4 added−4 removed

4 files+5 added−5 removed

modified:docs/content/manual/v1.7/manual.yml+1 added-1 removed
1060 unmodified lines
1061 - program: "pick(.a, .b.c, .x)"1062 input: '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}'1063 output: ['{"a":1,"b":{"c":2},"x":null}']10641065 - program: "[1,2,3,4] | pick(.[2], .[0], .[0])"1065 - program: "pick(.[2], .[0], .[0])"1066 input: "[1,2,3,4]"1067 output: ["[1,null,3]"]10681069 - title: "`path(path_expression)`"
2633 unmodified lines
modified:docs/content/manual/manual.yml+1 added-1 removed
1063 unmodified lines
1064 - program: 'pick(.a, .b.c, .x)'1065 input: '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}'1066 output: ['{"a":1,"b":{"c":2},"x":null}']10671068 - program: '[1,2,3,4] | pick(.[2], .[0], .[0])'1068 - program: 'pick(.[2], .[0], .[0])'1069 input: '[1,2,3,4]'1070 output: ['[1,null,3]']10711072
2630 unmodified lines
modified:tests/man.test+1 added-1 removed
247 unmodified lines
248pick(.a, .b.c, .x)249{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}250{"a":1,"b":{"c":2},"x":null}251252[1,2,3,4] | pick(.[2], .[0], .[0])252pick(.[2], .[0], .[0])253[1,2,3,4]254[1,null,3]255256path(.a[0].b)
705 unmodified lines
modified:jq.1.prebuilt+2 added-2 removed
1.2.TH "JQ" "1" "September 2023" "" ""2.TH "JQ" "1" "October 2023" "" ""3.4.SH "NAME"5\fBjq\fR \- Command\-line JSON processor6.
1058 unmodified lines
1065jq \'pick(\.a, \.b\.c, \.x)\'1066 {"a": 1, "b": {"c": 2, "d": 3}, "e": 4}1067=> {"a":1,"b":{"c":2},"x":null}10681069jq \'[1,2,3,4] | pick(\.[2], \.[0], \.[0])\'1069jq \'pick(\.[2], \.[0], \.[0])\'1070 [1,2,3,4]1071=> [1,null,3]1072.1073.fi
3056 unmodified lines