From 60da0a2b52f08d24b787e8dae1fe7037213dd327 Mon Sep 17 00:00:00 2001 From: Igor Murzov Date: Sun, 18 Mar 2012 03:05:33 +0400 Subject: ctest: New completion. --- completions/Makefile.am | 1 + completions/ctest | 81 ++++++++++++++++++++++++++++++++++++++++++ test/completion/ctest.exp | 1 + test/lib/completions/ctest.exp | 18 ++++++++++ 4 files changed, 101 insertions(+) create mode 100644 completions/ctest create mode 100644 test/completion/ctest.exp create mode 100644 test/lib/completions/ctest.exp diff --git a/completions/Makefile.am b/completions/Makefile.am index 5f830166..17016e2a 100644 --- a/completions/Makefile.am +++ b/completions/Makefile.am @@ -58,6 +58,7 @@ bashcomp_DATA = a2x \ cppcheck \ crontab \ cryptsetup \ + ctest \ curl \ cvs \ cvsps \ diff --git a/completions/ctest b/completions/ctest new file mode 100644 index 00000000..9707f626 --- /dev/null +++ b/completions/ctest @@ -0,0 +1,81 @@ +# bash completion for ctest(1) -*- shell-script -*- + +_ctest() +{ + local cur prev words cword + _init_completion -n = || return + + case "$prev" in + -C|--build-config) + COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo + MinSizeRel' -- "$cur" ) ) + return + ;; + -j|--parallel) + COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) ) + return + ;; + -O|--output-log|-A|--add-notes|--extra-submit) + _filedir + return + ;; + -L|--label-regex|-LE|--label-exclude|--track|-I|--tests-information|\ + --max-width|--timeout|--stop-time) + # argument required but no completions available + return + ;; + -R|--tests-regex|-E|--exclude-regex) + COMPREPLY=( $( compgen -W '$( ctest -N 2>/dev/null | + grep "^ Test" 2>/dev/null | cut -d: -f 2 )' -- "$cur" ) ) + return + ;; + -D|--dashboard) + if [[ $cur == @(Experimental|Nightly|Continuous)* ]]; then + local model action + action=${cur#@(Experimental|Nightly|Continuous)} + model=${cur%"$action"} + COMPREPLY=( $( compgen -W 'Start Update Configure Build Test + Coverage Submit MemCheck' -P "$model" -- "$action" ) ) + else + COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' \ + -- "$cur" ) ) + compopt -o nospace + fi + return + ;; + -M|--test-model) + COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' -- \ + "$cur" ) ) + return + ;; + -T|--test-action) + COMPREPLY=( $( compgen -W 'Start Update Configure Build Test + Coverage Submit MemCheck' -- "$cur" ) ) + return + ;; + -S|--script|-SP|--script-new-process) + # FIXME ? + return + ;; + --interactive-debug-mode) + COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) + return + ;; + --help-command) + COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null| + tail -n +2 )' -- "$cur" ) ) + return + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + [[ $COMPREPLY ]] && return + fi + + _filedir +} && +complete -F _ctest ctest + +# ex: ts=4 sw=4 et filetype=sh diff --git a/test/completion/ctest.exp b/test/completion/ctest.exp new file mode 100644 index 00000000..1b4e13cf --- /dev/null +++ b/test/completion/ctest.exp @@ -0,0 +1 @@ +assert_source_completions ctest diff --git a/test/lib/completions/ctest.exp b/test/lib/completions/ctest.exp new file mode 100644 index 00000000..406640c5 --- /dev/null +++ b/test/lib/completions/ctest.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup +assert_complete_any "ctest " + + +sync_after_int + + +teardown -- cgit v1.2.1