Skip to content

Commit

Permalink
tox: New completion (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored and scop committed Oct 5, 2017
1 parent d63b33d commit 89fb872
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ bashcomp_DATA = 2to3 \
tcpnice \
timeout \
tipc \
tox \
tracepath \
tshark \
tune2fs \
Expand Down
32 changes: 32 additions & 0 deletions completions/tox
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# tox completion -*- shell-script -*-

_tox()
{
local cur prev words cword
_init_completion || return

case $prev in
-h|--help|--version|-n|--num|-i|--index-url|--hashseed|--force-dep)
return
;;
-c)
_filedir ini
return
;;
--installpkg|--result-json|--workdir)
_filedir
return
;;
-e)
local envs=$( "$1" --listenvs-all )
COMPREPLY=( $( compgen -W "$envs" -- "$cur" ) )
return
;;
esac

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return
fi
} &&
complete -F _tox tox
1 change: 1 addition & 0 deletions test/completion/tox.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions tox
18 changes: 18 additions & 0 deletions test/lib/completions/tox.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "tox -"
sync_after_int


teardown

0 comments on commit 89fb872

Please sign in to comment.