2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for configure -*- shell-script -*-
|
2009-06-08 16:51:48 +02:00
|
|
|
|
|
|
|
_configure()
|
|
|
|
{
|
2011-05-01 22:18:40 +03:00
|
|
|
local cur prev words cword split
|
|
|
|
_init_completion -s || return
|
2009-11-01 20:41:57 +02:00
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2011-05-02 11:15:30 +03:00
|
|
|
-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)
|
2009-11-01 20:41:57 +02:00
|
|
|
_filedir -d
|
2011-05-02 11:15:30 +03:00
|
|
|
return
|
2009-11-01 20:41:57 +02:00
|
|
|
;;
|
|
|
|
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
|
2009-11-01 21:01:18 +02:00
|
|
|
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" ) )
|
2011-05-02 11:41:52 +03:00
|
|
|
[[ $COMPREPLY == *=* ]] && compopt -o nospace
|
2009-10-04 19:42:50 +02:00
|
|
|
else
|
2011-04-28 21:21:31 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
2011-05-02 11:41:52 +03:00
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _configure configure
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|