Skip to content

Commit

Permalink
tox: Complete comma separated -e arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jan 28, 2018
1 parent 3e9e03b commit eb8a7e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion completions/tox
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ _tox()
;;
-e)
local envs=$( "$1" --listenvs-all 2>/dev/null )
COMPREPLY=( $( compgen -W "$envs ALL" -- "$cur" ) )
local prefix=""; [[ $cur == *,* ]] && prefix="${cur%,*},"
COMPREPLY=( $( compgen -W "$envs ALL" -- "${cur##*,}" ) )
[[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} )
return
;;
esac
Expand Down
3 changes: 3 additions & 0 deletions test/lib/completions/tox.exp
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ sync_after_int
assert_complete "ALL" "tox -e "
sync_after_int

assert_complete "ALL" "tox -e foo,"
sync_after_int


teardown

0 comments on commit eb8a7e7

Please sign in to comment.