[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-349-ga0834d3

Igor Murzov e-mail at date.by
Sun Jun 5 21:13:50 UTC 2011


The following commit has been merged in the master branch:
commit a0834d3bf49864f9e04fe07134ee6dc72b8bbc24
Author: Igor Murzov <e-mail at date.by>
Date:   Mon Jun 6 01:06:25 2011 +0400

    kcov: New completion

diff --git a/completions/Makefile.am b/completions/Makefile.am
index 929dc12..4b08f41 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -73,6 +73,7 @@ bashcomp_DATA = abook \
 		jar \
 		java \
 		k3b \
+		kcov \
 		kldload \
 		larch \
 		ldapvi \
diff --git a/completions/mc b/completions/kcov
similarity index 54%
copy from completions/mc
copy to completions/kcov
index 27ddc0a..d330a48 100644
--- a/completions/mc
+++ b/completions/kcov
@@ -1,38 +1,39 @@
-# bash completion for mc
+have kcov || return
 
-have mc || return
-
-_mc()
+_kcov()
 {
     local cur prev words cword split
     _init_completion -s || return
 
-    case $prev in
-        -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
-            _filedir
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
+        return 0
+    fi
+
+    case "$prev" in
+        --pid|-p)
+            _pids
             return 0
             ;;
-        -C|--colors|-D|--debuglevel)
-            # argument required but no completions available
+        --sort-type|-s)
+            COMPREPLY=( $( compgen -W 'f p' -- "$cur" ) )
             return 0
             ;;
-        -h|--help|--help-*|-V|--version)
-            # all other arguments are noop with these
+        --include-path|--exclude-path)
+            _filedir
+            return 0
+            ;;
+        --limits|-l|--title|-t|--include-pattern|--exclude-pattern)
+            # argument required but no completions available
             return 0
             ;;
     esac
 
     $split && return 0
 
-    if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \
-            -- "$cur" ) )
-        [[ $COMPREPLY == *= ]] && compopt -o nospace
-    else
-        _filedir -d
-    fi
-} &&
-complete -F _mc mc
+    _filedir
+} && complete -F _kcov kcov
 
 # Local variables:
 # mode: shell-script
diff --git a/test/completion/kcov.exp b/test/completion/kcov.exp
new file mode 100644
index 0000000..4f0b9a7
--- /dev/null
+++ b/test/completion/kcov.exp
@@ -0,0 +1 @@
+assert_source_completions kcov
diff --git a/test/lib/completions/kcov.exp b/test/lib/completions/kcov.exp
new file mode 100644
index 0000000..f2a5031
--- /dev/null
+++ b/test/lib/completions/kcov.exp
@@ -0,0 +1,29 @@
+proc setup {} {
+    save_env
+}
+
+
+proc teardown {} {
+    assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "kcov "
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --help --pid= --sort-type= --limits= --title= --include-path=\
+                  --exclude-path= --include-pattern= --exclude-pattern=]
+assert_complete $options "kcov --" $test
+
+
+sync_after_int
+
+
+teardown

-- 
bash-completion



More information about the Bash-completion-commits mailing list