diff options
Diffstat (limited to 'completions/tox')
-rw-r--r-- | completions/tox | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/completions/tox b/completions/tox index a6418aca..7dcddc54 100644 --- a/completions/tox +++ b/completions/tox @@ -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 @@ -20,15 +26,18 @@ _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 ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + COMPREPLY=( $(compgen -W '$(_parse_help "$1") --' -- "$cur") ) return fi } && |