PageRenderTime 39ms CodeModel.GetById 36ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/complete/pkg-config

http://github.com/brinkman83/bashrc
#! | 32 lines | 24 code | 8 blank | 0 comment | 0 complexity | ea4e976fb49f7395cfe2d8c6800626ba MD5 | raw file
 1# pkgconfig(1) completion
 2
 3
 4comp_include _get_cword
 5
 6
 7_pkg_config()
 8{
 9    local cur
10
11    COMPREPLY=()
12    cur=`_get_cword`
13
14    if [[ "$cur" == -* ]]; then
15        # return list of available options
16        COMPREPLY=( $( compgen -W '-version --modversion \
17              --atleast-pkgconfig-version= --libs --libs-only-l \
18              --libs-only-other --libs-only-L --cflags \
19              --cflags-only-I --cflags-only-other --variable= \
20              --define-variable= --exists --uninstalled \
21              --atleast-version= --exact-version= --max-version= \
22              --list-all --debug --print-errors --silence-errors \
23              --errors-to-stdout -? --help --usage' -- $cur))
24    else
25        COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
26                    awk '{print $1}' | grep "^$cur" ) )
27    fi
28} # _pkg_config()
29
30comp_install -F _pkg_config  # Make completion persistent for subsequent invocations
31
32_pkg_config  # Generate completions for first invocation