ctest 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # bash completion for ctest(1) -*- shell-script -*-
  2. _ctest()
  3. {
  4. local cur prev words cword
  5. if type -t _init_completion >/dev/null; then
  6. _init_completion -n = || return
  7. else
  8. # manual initialization for older bash completion versions
  9. COMPREPLY=()
  10. cur="${COMP_WORDS[COMP_CWORD]}"
  11. prev="${COMP_WORDS[COMP_CWORD-1]}"
  12. fi
  13. case "$prev" in
  14. -C|--build-config)
  15. COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
  16. MinSizeRel' -- "$cur" ) )
  17. return
  18. ;;
  19. -j|--parallel)
  20. COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
  21. return
  22. ;;
  23. -O|--output-log|-A|--add-notes|--extra-submit)
  24. _filedir
  25. return
  26. ;;
  27. -L|--label-regex|-LE|--label-exclude)
  28. COMPREPLY=( $( compgen -W '$( ctest --print-labels 2>/dev/null |
  29. grep "^ " 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) )
  30. return
  31. ;;
  32. --track|-I|--tests-information|--max-width|--timeout|--stop-time)
  33. # argument required but no completions available
  34. return
  35. ;;
  36. -R|--tests-regex|-E|--exclude-regex)
  37. COMPREPLY=( $( compgen -W '$( ctest -N 2>/dev/null |
  38. grep "^ Test" 2>/dev/null | cut -d: -f 2 )' -- "$cur" ) )
  39. return
  40. ;;
  41. -D|--dashboard)
  42. if [[ $cur == @(Experimental|Nightly|Continuous)* ]]; then
  43. local model action
  44. action=${cur#@(Experimental|Nightly|Continuous)}
  45. model=${cur%"$action"}
  46. COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
  47. Coverage Submit MemCheck' -P "$model" -- "$action" ) )
  48. else
  49. COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' \
  50. -- "$cur" ) )
  51. compopt -o nospace
  52. fi
  53. return
  54. ;;
  55. -M|--test-model)
  56. COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' -- \
  57. "$cur" ) )
  58. return
  59. ;;
  60. -T|--test-action)
  61. COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
  62. Coverage Submit MemCheck' -- "$cur" ) )
  63. return
  64. ;;
  65. -S|--script|-SP|--script-new-process)
  66. _filedir '@(cmake|ctest)'
  67. return
  68. ;;
  69. --interactive-debug-mode)
  70. COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
  71. return
  72. ;;
  73. --help-command)
  74. COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
  75. grep -v "^ctest version " )' -- "$cur" ) )
  76. return
  77. ;;
  78. --help-manual)
  79. COMPREPLY=( $( compgen -W '$( ctest --help-manual-list 2>/dev/null|
  80. grep -v "^ctest version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
  81. return
  82. ;;
  83. --help-module)
  84. COMPREPLY=( $( compgen -W '$( ctest --help-module-list 2>/dev/null|
  85. grep -v "^ctest version " )' -- "$cur" ) )
  86. return
  87. ;;
  88. --help-policy)
  89. COMPREPLY=( $( compgen -W '$( ctest --help-policy-list 2>/dev/null |
  90. grep -v "^ctest version " )' -- "$cur" ) )
  91. return
  92. ;;
  93. --help-property)
  94. COMPREPLY=( $( compgen -W '$( ctest --help-property-list \
  95. 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
  96. return
  97. ;;
  98. --help-variable)
  99. COMPREPLY=( $( compgen -W '$( ctest --help-variable-list \
  100. 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
  101. return
  102. ;;
  103. esac
  104. if [[ "$cur" == -* ]]; then
  105. COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
  106. [[ $COMPREPLY == *= ]] && compopt -o nospace
  107. [[ $COMPREPLY ]] && return
  108. fi
  109. _filedir
  110. } &&
  111. complete -F _ctest ctest
  112. # ex: ts=4 sw=4 et filetype=sh