/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
- # pkgconfig(1) completion
- comp_include _get_cword
- _pkg_config()
- {
- local cur
- COMPREPLY=()
- cur=`_get_cword`
- if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '-version --modversion \
- --atleast-pkgconfig-version= --libs --libs-only-l \
- --libs-only-other --libs-only-L --cflags \
- --cflags-only-I --cflags-only-other --variable= \
- --define-variable= --exists --uninstalled \
- --atleast-version= --exact-version= --max-version= \
- --list-all --debug --print-errors --silence-errors \
- --errors-to-stdout -? --help --usage' -- $cur))
- else
- COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
- awk '{print $1}' | grep "^$cur" ) )
- fi
- } # _pkg_config()
- comp_install -F _pkg_config # Make completion persistent for subsequent invocations
- _pkg_config # Generate completions for first invocation