cpack 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # bash completion for cpack(1) -*- shell-script -*-
  2. _cpack()
  3. {
  4. local cur prev words cword
  5. _init_completion -n = || return
  6. case "$prev" in
  7. -G)
  8. COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
  9. grep "^ .*= .*" 2> /dev/null | grep -v "^ -" 2>/dev/null |
  10. cut -d" " -f 3 )' -- "$cur" ) )
  11. return
  12. ;;
  13. -C)
  14. COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
  15. MinSizeRel' -- "$cur" ) )
  16. return
  17. ;;
  18. -D)
  19. [[ $cur == *=* ]] && return # no completion for values
  20. COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
  21. 2>/dev/null | tail -n +2 )' -S = -- "$cur" ) )
  22. compopt -o nospace
  23. return
  24. ;;
  25. -P|-R|--vendor)
  26. # argument required but no completions available
  27. return
  28. ;;
  29. -B)
  30. _filedir -d
  31. return
  32. ;;
  33. --config)
  34. _filedir
  35. return
  36. ;;
  37. --help-command)
  38. COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
  39. tail -n +2 )' -- "$cur" ) )
  40. return
  41. ;;
  42. --help-variable)
  43. COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
  44. 2>/dev/null | tail -n +2 )' -- "$cur" ) )
  45. return
  46. ;;
  47. esac
  48. if [[ "$cur" == -* ]]; then
  49. COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
  50. [[ $COMPREPLY == *= ]] && compopt -o nospace
  51. [[ $COMPREPLY ]] && return
  52. fi
  53. _filedir
  54. } &&
  55. complete -F _cpack cpack
  56. # ex: ts=4 sw=4 et filetype=sh