diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml index 6382d8354a..e6edbc7ba0 100644 --- a/docs/content/manual/manual.yml +++ b/docs/content/manual/manual.yml @@ -1048,10 +1048,11 @@ sections: - title: "`pick(pathexps)`" body: | - Emit the projection of the input object or array defined by the specified - sequence of path expressions, such that if p is any one of these specifications, - then `(. | p)` will evaluate to the same value as `(. | pick(pathexps) | p)`. - For arrays, negative indices and .[m:n] specifications should not be used. + Emit the projection of the input object or array defined by the + specified sequence of path expressions, such that if `p` is any + one of these specifications, then `(. | p)` will evaluate to the + same value as `(. | pick(pathexps) | p)`. For arrays, negative + indices and `.[m:n]` specifications should not be used. examples: - program: 'pick(.a, .b.c, .x)' diff --git a/jq.1.prebuilt b/jq.1.prebuilt index f386b49ce8..162881c11b 100644 --- a/jq.1.prebuilt +++ b/jq.1.prebuilt @@ -1050,7 +1050,7 @@ jq \'map_values(\. // empty)\' .IP "" 0 . .SS "pick(pathexps)" -Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if p is any one of these specifications, then \fB(\. | p)\fR will evaluate to the same value as \fB(\. | pick(pathexps) | p)\fR\. For arrays, negative indices and \.[m:n] specifications should not be used\. +Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if \fBp\fR is any one of these specifications, then \fB(\. | p)\fR will evaluate to the same value as \fB(\. | pick(pathexps) | p)\fR\. For arrays, negative indices and \fB\.[m:n]\fR specifications should not be used\. . .IP "" 4 . diff --git a/tests/jq.test b/tests/jq.test index de38e4def6..1dcb2542c8 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -248,9 +248,9 @@ null 2 3 -.[-2] +[.[-4,-3,-2,-1,0,1,2,3]] [1,2,3] -2 +[null,1,2,3,1,2,3,null] [range(0;10)] null @@ -1052,9 +1052,9 @@ pick(first|first) [[10]] # negative indices in path expressions (since last/1 is .[-1]) -pick(last) -[[10,20],30] -[null,30] +try pick(last) catch . +[1,2] +"Out of bounds negative array index" # # Assignment