summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2013-03-19 19:11:27 +0200
committerVille Skyttä <ville.skytta@iki.fi>2013-03-19 19:11:27 +0200
commit408cb08051cf18404f89e3fb89c4924cc3fa04ea (patch)
tree35882ded350012a8bfc84252fc0184eff6fffe50
parent29f5a4a5f4403f246e22fb8c2133e8696d2f0e41 (diff)
downloadbash-completion-408cb08051cf18404f89e3fb89c4924cc3fa04ea.tar.gz
pkg-config: Try to complete --variable= if package name is already given.
-rw-r--r--completions/pkg-config14
1 files changed, 13 insertions, 1 deletions
diff --git a/completions/pkg-config b/completions/pkg-config
index 0156c0dd..f861c30e 100644
--- a/completions/pkg-config
+++ b/completions/pkg-config
@@ -6,11 +6,23 @@ _pkg_config()
_init_completion -s || return
case $prev in
- --variable|--define-variable|--atleast-version|--atleast-pkgconfig-version| \
+ --define-variable|--atleast-version|--atleast-pkgconfig-version| \
--exact-version|--max-version)
# argument required but no completions available
return 0
;;
+ --variable)
+ local i
+ for (( i=1; i < ${#words[@]}; i++ )); do
+ if [[ ${words[i]} != -* ]]; then
+ COMPREPLY=( $( compgen -W \
+ '$( "$1" ${words[i]} --print-variables 2>/dev/null )' \
+ -- "$cur" ) )
+ break
+ fi
+ done
+ return 0
+ ;;
-\?|--help|--version|--usage)
# all other arguments are noop with these
return 0