summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2011-12-14 19:23:55 +0400
committerIgor Murzov <e-mail@date.by>2011-12-14 19:23:55 +0400
commit2c4d20a02e3193470440b75032a8baf32a8a8a62 (patch)
treed3159a104fa769280eb4b06b4cfdea8d89620fbd
parentbe085fbe2307da832f00c20b23d1bbba7ff08732 (diff)
downloadbash-completion-2c4d20a02e3193470440b75032a8baf32a8a8a62.tar.gz
cppcheck: Several ids separated by commas can be given for --enable=.
-rw-r--r--completions/cppcheck8
-rw-r--r--test/lib/completions/cppcheck.exp12
2 files changed, 20 insertions, 0 deletions
diff --git a/completions/cppcheck b/completions/cppcheck
index 24b877a4..d3c7a422 100644
--- a/completions/cppcheck
+++ b/completions/cppcheck
@@ -15,8 +15,16 @@ _cppcheck()
return
;;
--enable)
+ # split comma-separated list
+ split=false
+ if [[ "$cur" == ?*,* ]]; then
+ prev="${cur%,*}"
+ cur="${cur##*,}"
+ split=true
+ fi
COMPREPLY=( $( compgen -W 'all style performance portability
information unusedFunction missingInclude' -- "$cur" ) )
+ $split && COMPREPLY=( ${COMPREPLY[@]/#/"$prev,"} )
return
;;
--error-exitcode)
diff --git a/test/lib/completions/cppcheck.exp b/test/lib/completions/cppcheck.exp
index 4acd709a..80b6e7b6 100644
--- a/test/lib/completions/cppcheck.exp
+++ b/test/lib/completions/cppcheck.exp
@@ -27,4 +27,16 @@ assert_no_complete "cppcheck -D "
sync_after_int
+assert_complete "--enable=all" "cppcheck --enable=al"
+sync_after_int
+
+
+assert_complete "--enable=xx,style" "cppcheck --enable=xx,styl"
+sync_after_int
+
+
+assert_complete "--enable=xx,yy,style" "cppcheck --enable=xx,yy,styl"
+sync_after_int
+
+
teardown