-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Milestone
Description
Describe the bug
if has an optional else clause but it seems to not work in combination with one or more elif clauses.
To Reproduce
$ jq --version
jq-1.6-159-gcff5336
$ jq -n '1,2,3 | if . == 1 then 1 elif . == 2 then 2 end'
jq: error: syntax error, unexpected end (Unix shell quoting issues?) at <top-level>, line 1:
1,2,3 | if . == 1 then 1 elif . == 2 then 2 end
jq: error: Possibly unterminated 'if' statement at <top-level>, line 1:
1,2,3 | if . == 1 then 1 elif . == 2 then 2 end
jq: 2 compile errorsExpected behavior
$ jq -n '1,2,3 | if . == 1 then 1 elif . == 2 then 2 end'
1
2
3Same as 1,2,3 | if . == 1 then 1 elif . == 2 then 2 else . end
Environment:
jq-1.6-159-gcff5336
Additional context
gojq supports optional else in combination with elif:s.
tkapias