Skip to content

Commit

Permalink
tox: complete defaults after a --
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jun 21, 2019
1 parent f8fac3a commit c06cfb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions completions/tox
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ _tox()
local cur prev words cword
_init_completion || return

# Complete defaults following a "--"
if [[ "${words[*]:0:cword} " == *\ --\ * && $cur != -- ]]; then
compopt -o bashdefault -o default
return
fi

case $prev in
--help|--version|--num|--index-url|--hashseed|--force-dep|-!(-*)[hni])
return
Expand Down
4 changes: 4 additions & 0 deletions test/t/test_tox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ def test_2(self, completion):
@pytest.mark.complete("tox -e foo,", cwd="tox")
def test_3(self, completion):
assert all(x in completion for x in "py37 ALL".split())

@pytest.mark.complete("tox -e foo -- ", cwd="tox")
def test_default_after_dashdash(self, completion):
assert completion == ".tox/ tox.ini".split()

0 comments on commit c06cfb0

Please sign in to comment.