43 lines
1.2 KiB
Plaintext
Raw Normal View History

# bash completion for configure -*- shell-script -*-
2009-06-08 16:51:48 +02:00
_configure()
{
local cur prev words cword split
_init_completion -s || return
case $prev in
-h|--help|-V|--version|--program-prefix|--program-suffix|\
--program-transform-name)
return
;;
--*file)
_filedir
return
;;
2010-10-24 12:39:42 +03:00
--*prefix|--*dir)
_filedir -d
return
;;
esac
$split && return 0
2009-06-08 16:51:48 +02:00
2009-10-04 19:42:50 +02:00
# if $COMP_CONFIGURE_HINTS is not null, then completions of the form
# --option=SETTING will include 'SETTING' as a contextual hint
[[ "$cur" != -* ]] && return 0
2009-06-08 16:51:48 +02:00
2011-11-09 23:28:11 +02:00
if [[ -n $COMP_CONFIGURE_HINTS ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
awk '/^ --[A-Za-z]/ { print $1; \
if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
-- "$cur" ) )
[[ $COMPREPLY == *=* ]] && compopt -o nospace
2009-10-04 19:42:50 +02:00
else
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
2009-10-04 19:42:50 +02:00
fi
2011-04-04 22:14:39 +03:00
} &&
complete -F _configure configure
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh