2011-11-01 13:14:45 -07:00
|
|
|
# bash completion for cppcheck(1) -*- shell-script -*-
|
2011-05-01 02:13:32 -07:00
|
|
|
|
|
|
|
_cppcheck()
|
|
|
|
{
|
2011-05-01 12:18:40 -07:00
|
|
|
local cur prev words cword split
|
|
|
|
_init_completion -s || return
|
2011-05-01 02:13:32 -07:00
|
|
|
|
|
|
|
case $prev in
|
2015-01-25 06:37:35 -08:00
|
|
|
--append|--exitcode-suppressions|--rule-file|--config-excludes-file|\
|
2013-03-31 11:19:59 -07:00
|
|
|
--suppressions-list|--includes-file|--include|-i)
|
2011-05-01 02:13:32 -07:00
|
|
|
_filedir
|
|
|
|
return
|
|
|
|
;;
|
2015-01-25 06:37:35 -08:00
|
|
|
-D|-U|--rule|--suppress|--template|--max-configs|-h|--help|--version|\
|
|
|
|
--errorlist|--config-exclude|-l)
|
2011-05-01 02:13:32 -07:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
--enable)
|
2011-12-14 07:23:55 -08:00
|
|
|
# split comma-separated list
|
|
|
|
split=false
|
|
|
|
if [[ "$cur" == ?*,* ]]; then
|
|
|
|
prev="${cur%,*}"
|
|
|
|
cur="${cur##*,}"
|
|
|
|
split=true
|
|
|
|
fi
|
2013-08-05 14:12:43 -07:00
|
|
|
COMPREPLY=( $( compgen -W 'all warning style performance
|
|
|
|
portability information unusedFunction missingInclude' \
|
|
|
|
-- "$cur" ) )
|
2011-12-14 07:23:55 -08:00
|
|
|
$split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} )
|
2011-05-01 02:13:32 -07:00
|
|
|
return
|
|
|
|
;;
|
2011-05-02 00:28:38 -07:00
|
|
|
--error-exitcode)
|
2011-05-01 02:13:32 -07:00
|
|
|
COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
|
|
|
|
return
|
|
|
|
;;
|
2013-12-28 00:58:59 -08:00
|
|
|
--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
|
|
|
|
;;
|
2012-10-28 13:36:14 -07:00
|
|
|
--language|-x)
|
|
|
|
COMPREPLY=( $( compgen -W 'c c++' -- "$cur" ) )
|
|
|
|
return
|
|
|
|
;;
|
2011-09-16 10:06:25 -07:00
|
|
|
--std)
|
2012-09-05 04:34:56 -07:00
|
|
|
COMPREPLY=( $( compgen -W 'c89 c99 c11 c++03 c++11 posix' \
|
|
|
|
-- "$cur" ) )
|
2011-09-16 10:06:25 -07:00
|
|
|
return
|
|
|
|
;;
|
2011-09-20 16:46:37 -07:00
|
|
|
--platform)
|
2011-10-30 02:09:13 -07:00
|
|
|
COMPREPLY=( $( compgen -W 'unix32 unix64 win32A win32W win64' \
|
|
|
|
-- "$cur" ) )
|
2011-09-20 16:46:37 -07:00
|
|
|
return
|
|
|
|
;;
|
2012-04-15 13:37:14 -07:00
|
|
|
-rp|--relative-paths)
|
|
|
|
if $split; then # -rp without argument is allowed
|
|
|
|
_filedir -d
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
;;
|
2013-08-05 14:12:43 -07:00
|
|
|
--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" ) )
|
2011-10-30 02:07:38 -07:00
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
2011-05-01 02:13:32 -07:00
|
|
|
else
|
2014-06-04 13:42:11 -07:00
|
|
|
_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
|