Skip to content

Commit 787b2b1

Browse files
committed
fix(jq): do not complete after --args or --jsonargs
Closes scop#511
1 parent 805270d commit 787b2b1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

completions/jq

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ _jq()
5757
return
5858
fi
5959

60+
local word
61+
for word in "${words[@]}"; do
62+
[[ $word != --?(json)args ]] || return
63+
done
64+
6065
local args
6166
# TODO: DTRT with args taking 2 options
6267
# -f|--from-file are not counted here because they supply the filter

test/t/test_jq.py

+8
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ def test_5(self, completion):
2828
@pytest.mark.complete("jq --slurpfile foo ")
2929
def test_6(self, completion):
3030
assert completion
31+
32+
@pytest.mark.complete("jq --args ")
33+
def test_no_completion_after_args(self, completion):
34+
assert not completion
35+
36+
@pytest.mark.complete("jq --jsonargs foo ")
37+
def test_no_completion_after_jsonargs(self, completion):
38+
assert not completion

0 commit comments

Comments
 (0)