Skip to content

Commit

Permalink
tox: do simple parse on tox.ini if --listenvs* yields nothing
Browse files Browse the repository at this point in the history
Old versions do not have --listenvs-all or --listenvs.
  • Loading branch information
scop committed May 14, 2019
1 parent a81a1e8 commit d7c92e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion completions/tox
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ _tox()
-!(-*)e)
local envs=$(
{ "$1" --listenvs-all || "$1" --listenvs; } 2>/dev/null )
[[ $envs ]] || envs=$(
command sed -e 's/,/ /g' -ne 's/^envlist[[:space:]]*=//p' \
tox.ini 2>/dev/null)
local prefix=""; [[ $cur == *,* ]] && prefix="${cur%,*},"
COMPREPLY=( $(compgen -W "$envs ALL" -- "${cur##*,}") )
COMPREPLY=( $(compgen -X '*[{}]*' -W "$envs ALL" -- "${cur##*,}") )
[[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=( ${COMPREPLY/#/$prefix} )
return
;;
Expand Down

0 comments on commit d7c92e6

Please sign in to comment.