Skip to content

Commit 4d6f299

Browse files
authored
feat(python): tweak -h output for _parse_help to find -bb
1 parent 081c757 commit 4d6f299

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

completions/python

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ _python()
6767
elif [[ $cur != -* ]]; then
6868
_filedir '@(py?([cowz])|zip)'
6969
else
70-
COMPREPLY=($(compgen -W '$(_parse_help "$1" -h)' -- "$cur"))
70+
COMPREPLY=($(compgen -W \
71+
'$("$1" -h | awk "{ sub(\"\\\(-bb:\",\"\n-bb \"); print }" |
72+
_parse_help -)' -- "$cur"))
7173
fi
7274
} &&
7375
complete -F _python python python2 python2.7 python3 python3.{3..11} \

test/t/test_pyston.py

+8
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ def test_basic(self, completion):
99
@pytest.mark.complete("pyston -")
1010
def test_options(self, completion):
1111
assert completion
12+
13+
@pytest.mark.complete(
14+
"pyston -b",
15+
require_cmd=True,
16+
skipif="! pyston -h | command grep -qwF -- -bb",
17+
)
18+
def test_bb(self, completion):
19+
assert "-bb" in completion

test/t/test_python.py

+8
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ def test_8(self, completion):
3737
@pytest.mark.complete("python -m json.", require_cmd=True)
3838
def test_9(self, completion):
3939
assert "json.tool" in completion
40+
41+
@pytest.mark.complete(
42+
"python -b",
43+
require_cmd=True,
44+
skipif="! python -h | command grep -qwF -- -bb",
45+
)
46+
def test_bb(self, completion):
47+
assert "-bb" in completion

test/t/test_python3.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def test_7(self, completion):
3434
def test_8(self, completion):
3535
assert completion
3636

37-
@pytest.mark.complete("python3 -m json.", require_cmd=True)
38-
def test_9(self, completion):
39-
assert "json.tool" in completion
37+
@pytest.mark.complete(
38+
"python3 -b",
39+
require_cmd=True,
40+
skipif="! python3 -h | command grep -qwF -- -bb",
41+
)
42+
def test_bb(self, completion):
43+
assert "-bb" in completion

test/test-cmd-list.txt

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ pydocstyle
300300
pyflakes
301301
pylint
302302
pylint-3
303+
pyston
303304
python
304305
python3
305306
qemu

0 commit comments

Comments
 (0)