cppcheck: New completion.

This commit is contained in:
Ville Skyttä 2011-05-01 12:13:32 +03:00
parent a785f1c2f9
commit b202bc60f6
4 changed files with 84 additions and 0 deletions

View File

@ -27,6 +27,7 @@ bashcomp_DATA = abook \
cowsay \
cpan2dist \
cpio \
cppcheck \
crontab \
cups \
cryptsetup \

62
completions/cppcheck Normal file
View File

@ -0,0 +1,62 @@
# bash completion for cppcheck(1)
have cppcheck || return
_cppcheck()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
case $prev in
--append|--exitcode-suppressions|--file-list|--rule-file|\
--suppressions-list)
_filedir
return
;;
-D*|--rule|--suppress|--template)
return
;;
--enable)
COMPREPLY=( $( compgen -W 'all style information unusedFunction
missingInclude' -- "$cur" ) )
return
;;
--exitcode)
COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
return
;;
-I|-i)
_filedir -d
return
;;
-j)
COMPREPLY=( $( compgen -W '{2..16}' -- "$cur" ) )
return
;;
--xml-version)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == @(-D|*=) ]] && compopt -o nospace
else
_filedir @(cpp|cxx|cc|c++|c|tpp|txx)
fi
} &&
complete -F _cppcheck cppcheck
# 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

View File

@ -0,0 +1 @@
assert_source_completions cppcheck

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "cppcheck "
sync_after_int
teardown