Skip to content

Commit

Permalink
mypy, mysql, xmms: don't complete unknown split long option args
Browse files Browse the repository at this point in the history
Closes #303
  • Loading branch information
scop committed Apr 22, 2019
1 parent 366488f commit 1a698d5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions completions/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ _mypy()
;;
esac

$split && return

if [[ $cur == -* ]]; then
COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") )
return
Expand Down
2 changes: 2 additions & 0 deletions completions/mysql
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ _mysql()
;;
esac

$split && return

case $cur in
--*)
local help=$(_parse_help "$1")
Expand Down
2 changes: 2 additions & 0 deletions completions/xmms
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _xmms()
;;
esac

$split && return

if [[ "$cur" == -* ]]; then
COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") )
else
Expand Down
4 changes: 4 additions & 0 deletions test/t/test_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ def test_1(self, completion):
@pytest.mark.complete("mypy --")
def test_2(self, completion):
assert completion

@pytest.mark.complete("mypy --non-existent-option=--")
def test_3(self, completion):
assert not completion
4 changes: 4 additions & 0 deletions test/t/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ def test_1(self, completion):
@pytest.mark.complete("mysql --default-character-set=")
def test_2(self, completion):
assert completion

@pytest.mark.complete("mysql --non-existent-option=--")
def test_3(self, completion):
assert not completion
4 changes: 4 additions & 0 deletions test/t/test_xmms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ class TestXmms:
@pytest.mark.complete("xmms --")
def test_1(self, completion):
assert completion

@pytest.mark.complete("xmms --non-existent-option=--")
def test_2(self, completion):
assert not completion

0 comments on commit 1a698d5

Please sign in to comment.