2009-06-08 16:51:48 +02:00
|
|
|
# bash completion for configure
|
|
|
|
|
|
|
|
_configure()
|
|
|
|
{
|
2009-11-01 20:41:57 +02:00
|
|
|
local cur prev split=false
|
2009-06-08 16:51:48 +02:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=()
|
2010-02-08 17:25:08 +01:00
|
|
|
_get_comp_words_by_ref cur prev
|
2009-11-01 20:41:57 +02:00
|
|
|
|
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-12-30 00:39:59 +01:00
|
|
|
case $prev in
|
2010-10-24 12:39:42 +03:00
|
|
|
--*prefix|--*dir)
|
2009-11-01 20:41:57 +02:00
|
|
|
_filedir -d
|
|
|
|
;;
|
|
|
|
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
|
|
|
|
2009-10-04 19:42:50 +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" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
else
|
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" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2009-06-08 16:51:48 +02:00
|
|
|
}
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _configure configure
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|