bash-completion/completions/cppcheck

91 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

# bash completion for cppcheck(1) -*- shell-script -*-
2011-05-01 02:13:32 -07:00
_cppcheck()
{
local cur prev words cword split
_init_completion -s || return
2011-05-01 02:13:32 -07:00
case $prev in
--append|--exitcode-suppressions|--rule-file|--config-excludes-file|\
--suppressions-list|--includes-file|--include|-i)
2011-05-01 02:13:32 -07:00
_filedir
return
;;
-D|-U|--rule|--suppress|--template|--max-configs|-h|--help|--version|\
--errorlist|--config-exclude|-l)
2011-05-01 02:13:32 -07:00
return
;;
--enable)
# split comma-separated list
split=false
if [[ "$cur" == ?*,* ]]; then
prev="${cur%,*}"
cur="${cur##*,}"
split=true
fi
COMPREPLY=( $( compgen -W 'all warning style performance
portability information unusedFunction missingInclude' \
-- "$cur" ) )
$split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} )
2011-05-01 02:13:32 -07:00
return
;;
--error-exitcode)
2011-05-01 02:13:32 -07:00
COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
return
;;
--file-list)
_filedir
[[ -z $cur || $cur == - ]] && COMPREPLY+=( - )
return
;;
2011-09-20 16:31:52 -07:00
-I)
2011-05-01 02:13:32 -07:00
_filedir -d
return
;;
-j)
2011-11-09 08:35:37 -08:00
COMPREPLY=( $( compgen -W "{2..$(_ncpus)}" -- "$cur" ) )
2011-05-01 02:13:32 -07:00
return
;;
--language|-x)
COMPREPLY=( $( compgen -W 'c c++' -- "$cur" ) )
return
;;
--std)
COMPREPLY=( $( compgen -W 'c89 c99 c11 c++03 c++11 posix' \
-- "$cur" ) )
return
;;
--platform)
2011-10-30 02:09:13 -07:00
COMPREPLY=( $( compgen -W 'unix32 unix64 win32A win32W win64' \
-- "$cur" ) )
return
;;
-rp|--relative-paths)
if $split; then # -rp without argument is allowed
_filedir -d
return
fi
;;
--library)
_filedir cfg
return
;;
2011-05-01 02:13:32 -07:00
--xml-version)
COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
2011-05-01 02:13:32 -07:00
else
_filedir '@([cht]pp|[cht]xx|cc|[ch]++|[ch])'
2011-05-01 02:13:32 -07:00
fi
} &&
complete -F _cppcheck cppcheck
# ex: ts=4 sw=4 et filetype=sh