From a0834d3bf49864f9e04fe07134ee6dc72b8bbc24 Mon Sep 17 00:00:00 2001 From: Igor Murzov Date: Mon, 6 Jun 2011 01:06:25 +0400 Subject: [PATCH] kcov: New completion --- completions/Makefile.am | 1 + completions/kcov | 44 +++++++++++++++++++++++++++++++++++ test/completion/kcov.exp | 1 + test/lib/completions/kcov.exp | 29 +++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 completions/kcov create mode 100644 test/completion/kcov.exp create mode 100644 test/lib/completions/kcov.exp diff --git a/completions/Makefile.am b/completions/Makefile.am index 929dc12a..4b08f41c 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/kcov b/completions/kcov new file mode 100644 index 00000000..d330a480 --- /dev/null +++ b/completions/kcov @@ -0,0 +1,44 @@ +have kcov || return + +_kcov() +{ + local cur prev words cword split + _init_completion -s || return + + 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 + ;; + --sort-type|-s) + COMPREPLY=( $( compgen -W 'f p' -- "$cur" ) ) + return 0 + ;; + --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 + + _filedir +} && complete -F _kcov kcov + +# Local variables: +# mode: shell-script +# sh-basic-offset: 4 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/kcov.exp b/test/completion/kcov.exp new file mode 100644 index 00000000..4f0b9a7c --- /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 00000000..f2a50318 --- /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 "-- 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