/bash_completion.d/configure

http://github.com/brinkman83/bashrc · #! · 34 lines · 29 code · 5 blank · 0 comment · 0 complexity · 26a29b2422c6952b68e88f3c7da8bd3d MD5 · raw file

  1. # bash completion for configure
  2. _configure()
  3. {
  4. local cur
  5. COMPREPLY=()
  6. cur=`_get_cword`
  7. # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
  8. # --option=SETTING will include 'SETTING' as a contextual hint
  9. [[ "$cur" != -* ]] && return 0
  10. if [ -n "$COMP_CONFIGURE_HINTS" ]; then
  11. COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
  12. awk '/^ --[A-Za-z]/ { print $1; \
  13. if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
  14. -- "$cur" ) )
  15. else
  16. COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
  17. awk '/^ --[A-Za-z]/ { print $1; \
  18. if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" \
  19. -- "$cur" ) )
  20. fi
  21. }
  22. complete -F _configure $default configure
  23. # Local variables:
  24. # mode: shell-script
  25. # sh-basic-offset: 4
  26. # sh-indent-comment: t
  27. # indent-tabs-mode: nil
  28. # End:
  29. # ex: ts=4 sw=4 et filetype=sh