[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-91-g2c4d20a

Igor Murzov e-mail at date.by
Wed Dec 14 15:46:22 UTC 2011


The following commit has been merged in the master branch:
commit 2c4d20a02e3193470440b75032a8baf32a8a8a62
Author: Igor Murzov <e-mail at date.by>
Date:   Wed Dec 14 19:23:55 2011 +0400

    cppcheck: Several ids separated by commas can be given for --enable=.

diff --git a/completions/cppcheck b/completions/cppcheck
index 24b877a..d3c7a42 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 4acd709..80b6e7b 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list