Skip to content

Commit

Permalink
pycodestyle: New completion
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Dec 16, 2017
1 parent 15389e6 commit 0de48aa
Show file tree
Hide file tree
Showing 4 changed files with 60 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 @@ -303,6 +303,7 @@ bashcomp_DATA = 2to3 \
pwdx \
pwgen \
py.test \
pycodestyle \
pydoc \
pyflakes \
pylint \
Expand Down
34 changes: 34 additions & 0 deletions completions/pycodestyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# pycodestyle completion -*- shell-script -*-

_pycodestyle()
{
local cur prev words cword split
_init_completion -s || return

case $prev in
-h|--help|--version)
return
;;
--format)
COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) )
return
;;
--config)
_filedir
return
;;
esac

$split && return

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi

_filedir py
} &&
complete -F _pycodestyle pycodestyle

# ex: filetype=sh
1 change: 1 addition & 0 deletions test/completion/pycodestyle.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions pycodestyle
24 changes: 24 additions & 0 deletions test/lib/completions/pycodestyle.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "pycodestyle "
sync_after_int

assert_complete_any "pycodestyle -"
sync_after_int

assert_no_complete "pycodestyle --doesnt-exist="
sync_after_int


teardown

0 comments on commit 0de48aa

Please sign in to comment.