[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-147-g408cb08

Ville Skyttä ville.skytta at iki.fi
Tue Mar 19 17:12:18 UTC 2013


The following commit has been merged in the master branch:
commit 408cb08051cf18404f89e3fb89c4924cc3fa04ea
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Mar 19 19:11:27 2013 +0200

    pkg-config: Try to complete --variable= if package name is already given.

diff --git a/completions/pkg-config b/completions/pkg-config
index 0156c0d..f861c30 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list