kcov: New completion

This commit is contained in:
Igor Murzov 2011-06-06 01:06:25 +04:00
parent 3ac922e4a6
commit a0834d3bf4
4 changed files with 75 additions and 0 deletions

View File

@ -73,6 +73,7 @@ bashcomp_DATA = abook \
jar \
java \
k3b \
kcov \
kldload \
larch \
ldapvi \

44
completions/kcov Normal file
View File

@ -0,0 +1,44 @@
have kcov || return
_kcov()
{
local cur prev words cword split
_init_completion -s || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
case "$prev" in
--pid|-p)
_pids
return 0
;;
--sort-type|-s)
COMPREPLY=( $( compgen -W 'f p' -- "$cur" ) )
return 0
;;
--include-path|--exclude-path)
_filedir
return 0
;;
--limits|-l|--title|-t|--include-pattern|--exclude-pattern)
# argument required but no completions available
return 0
;;
esac
$split && return 0
_filedir
} && complete -F _kcov kcov
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

1
test/completion/kcov.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions kcov

View File

@ -0,0 +1,29 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "kcov "
sync_after_int
set test "--<TAB> should complete all long options"
set options [list --help --pid= --sort-type= --limits= --title= --include-path=\
--exclude-path= --include-pattern= --exclude-pattern=]
assert_complete $options "kcov --" $test
sync_after_int
teardown