# kcov(1) completion -*- shell-script -*- proc _kcov { var cur = '', prev = '', words = '', cword = '', split = '' _init_completion -s -n : || return match $prev { with --pid|-p _pids return with --sort-type|-s setglobal COMPREPLY = '( '$( compgen -W 'filename percent reverse lines uncovered' -- "$cur" ) ) return with --include-path|--exclude-path _filedir return with --replace-src-path if [[ "$cur" == ?*:* ]] { set cur = $(cur##*:) _filedir } else { _filedir compopt -o nospace } return with --limits|-l if [[ "$cur" == ?*,* ]] { set prev = $(cur%,*) set cur = $(cur##*,) setglobal COMPREPLY = '( '$( compgen -P "$prev," -W "{0..100}" -- "$cur" ) ) } else { setglobal COMPREPLY = '( '$( compgen -W "{0..100}" -- "$cur" ) ) compopt -o nospace } return with --title|-t|--include-pattern|--exclude-pattern|--path-strip-level # argument required but no completions available return } $split && return if [[ "$cur" == -* ]] { setglobal COMPREPLY = '( '$( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) ) [[ $COMPREPLY == *= ]] && compopt -o nospace return } _filedir } && complete -F _kcov kcov # ex: ts=4 sw=4 et filetype=sh