cpack 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # bash completion for cpack(1) -*- shell-script -*-
  2. _cpack()
  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. -G)
  15. COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
  16. sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \
  17. 2>/dev/null )' -- "$cur" ) )
  18. return
  19. ;;
  20. -C)
  21. COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
  22. MinSizeRel' -- "$cur" ) )
  23. return
  24. ;;
  25. -D)
  26. [[ $cur == *=* ]] && return # no completion for values
  27. COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
  28. 2>/dev/null | grep -v "^cpack version " )' -S = -- "$cur" ) )
  29. compopt -o nospace
  30. return
  31. ;;
  32. -P|-R|--vendor)
  33. # argument required but no completions available
  34. return
  35. ;;
  36. -B)
  37. _filedir -d
  38. return
  39. ;;
  40. --config)
  41. _filedir
  42. return
  43. ;;
  44. --help-command)
  45. COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
  46. grep -v "^cpack version " )' -- "$cur" ) )
  47. return
  48. ;;
  49. --help-manual)
  50. COMPREPLY=( $( compgen -W '$( cpack --help-manual-list 2>/dev/null|
  51. grep -v "^cpack version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
  52. return
  53. ;;
  54. --help-module)
  55. COMPREPLY=( $( compgen -W '$( cpack --help-module-list 2>/dev/null|
  56. grep -v "^cpack version " )' -- "$cur" ) )
  57. return
  58. ;;
  59. --help-policy)
  60. COMPREPLY=( $( compgen -W '$( cpack --help-policy-list 2>/dev/null |
  61. grep -v "^cpack version " )' -- "$cur" ) )
  62. return
  63. ;;
  64. --help-property)
  65. COMPREPLY=( $( compgen -W '$( cpack --help-property-list \
  66. 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
  67. return
  68. ;;
  69. --help-variable)
  70. COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
  71. 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
  72. return
  73. ;;
  74. esac
  75. if [[ "$cur" == -* ]]; then
  76. COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
  77. [[ $COMPREPLY == *= ]] && compopt -o nospace
  78. [[ $COMPREPLY ]] && return
  79. fi
  80. _filedir
  81. } &&
  82. complete -F _cpack cpack
  83. # ex: ts=4 sw=4 et filetype=sh