summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2012-03-18 03:05:33 +0400
committerIgor Murzov <e-mail@date.by>2012-03-18 03:05:33 +0400
commit60da0a2b52f08d24b787e8dae1fe7037213dd327 (patch)
tree19f2d703a6827aeb3a51bf3fe7f70bf4932ec4b8
parent52e14b2ec251ed11ceac6ca362c1fc7bbbd47f30 (diff)
downloadbash-completion-60da0a2b52f08d24b787e8dae1fe7037213dd327.tar.gz
ctest: New completion.
-rw-r--r--completions/Makefile.am1
-rw-r--r--completions/ctest81
-rw-r--r--test/completion/ctest.exp1
-rw-r--r--test/lib/completions/ctest.exp18
4 files changed, 101 insertions, 0 deletions
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