PageRenderTime 245ms CodeModel.GetById 242ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/complete -o default/configure

http://github.com/brinkman83/bashrc
#! | 25 lines | 17 code | 8 blank | 0 comment | 0 complexity | f10ae11ef9994d4c3332581b8cdd85c8 MD5 | raw file
 1comp_include _get_cword
 2
 3
 4_configure_func()
 5{
 6    local cur
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10
11    # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
12    # --option=SETTING will include 'SETTING' as a contextual hint
13    [[ "$cur" != -* ]] && return 0
14
15    if [ -n "$COMP_CONFIGURE_HINTS" ]; then
16        COMPREPLY=( $( $1 --help | awk '/^  --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) )
17
18    else
19        COMPREPLY=( $( $1 --help | awk '/^  --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) )
20    fi
21} # _configure_func()
22
23comp_install -F _configure_func  # Make completion persistent for subsequent invocations
24
25_configure_func  # Generate completions for first invocation