ctest 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # bash completion for ctest(1) -*- shell-script -*-
  2. _ctest()
  3. {
  4. local cur prev words cword
  5. _init_completion -n = || return
  6. case "$prev" in
  7. -C|--build-config)
  8. COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
  9. MinSizeRel' -- "$cur" ) )
  10. return
  11. ;;
  12. -j|--parallel)
  13. COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
  14. return
  15. ;;
  16. -O|--output-log|-A|--add-notes|--extra-submit)
  17. _filedir
  18. return
  19. ;;
  20. -L|--label-regex|-LE|--label-exclude|--track|-I|--tests-information|\
  21. --max-width|--timeout|--stop-time)
  22. # argument required but no completions available
  23. return
  24. ;;
  25. -R|--tests-regex|-E|--exclude-regex)
  26. COMPREPLY=( $( compgen -W '$( ctest -N 2>/dev/null |
  27. grep "^ Test" 2>/dev/null | cut -d: -f 2 )' -- "$cur" ) )
  28. return
  29. ;;
  30. -D|--dashboard)
  31. if [[ $cur == @(Experimental|Nightly|Continuous)* ]]; then
  32. local model action
  33. action=${cur#@(Experimental|Nightly|Continuous)}
  34. model=${cur%"$action"}
  35. COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
  36. Coverage Submit MemCheck' -P "$model" -- "$action" ) )
  37. else
  38. COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' \
  39. -- "$cur" ) )
  40. compopt -o nospace
  41. fi
  42. return
  43. ;;
  44. -M|--test-model)
  45. COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' -- \
  46. "$cur" ) )
  47. return
  48. ;;
  49. -T|--test-action)
  50. COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
  51. Coverage Submit MemCheck' -- "$cur" ) )
  52. return
  53. ;;
  54. -S|--script|-SP|--script-new-process)
  55. _filedir '@(cmake|ctest)'
  56. return
  57. ;;
  58. --interactive-debug-mode)
  59. COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
  60. return
  61. ;;
  62. --help-command)
  63. COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
  64. grep -v "^ctest version " )' -- "$cur" ) )
  65. return
  66. ;;
  67. esac
  68. if [[ "$cur" == -* ]]; then
  69. COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
  70. [[ $COMPREPLY == *= ]] && compopt -o nospace
  71. [[ $COMPREPLY ]] && return
  72. fi
  73. _filedir
  74. } &&
  75. complete -F _ctest ctest
  76. # ex: ts=4 sw=4 et filetype=sh