From 2c4d20a02e3193470440b75032a8baf32a8a8a62 Mon Sep 17 00:00:00 2001 From: Igor Murzov Date: Wed, 14 Dec 2011 19:23:55 +0400 Subject: cppcheck: Several ids separated by commas can be given for --enable=. --- completions/cppcheck | 8 ++++++++ test/lib/completions/cppcheck.exp | 12 ++++++++++++ 2 files changed, 20 insertions(+) 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 -- cgit v1.2.1