summaryrefslogtreecommitdiff
path: root/completions/pkg-config
diff options
context:
space:
mode:
Diffstat (limited to 'completions/pkg-config')
-rw-r--r--completions/pkg-config29
1 files changed, 5 insertions, 24 deletions
diff --git a/completions/pkg-config b/completions/pkg-config
index b999bd81..0156c0dd 100644
--- a/completions/pkg-config
+++ b/completions/pkg-config
@@ -1,14 +1,9 @@
-# bash completion for pkgconfig
+# bash completion for pkgconfig -*- shell-script -*-
-have pkg-config &&
_pkg_config()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _split_longopt && split=true
+ local cur prev words cword split
+ _init_completion -s || return
case $prev in
--variable|--define-variable|--atleast-version|--atleast-pkgconfig-version| \
@@ -25,16 +20,8 @@ _pkg_config()
$split && return 0
if [[ "$cur" == -* ]]; then
- # return list of available options
- COMPREPLY=( $( compgen -W '--version --modversion \
- --atleast-pkgconfig-version --libs --static \
- --short-errors --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 \
- --print-provides --print-requires --help --usage' -- "$cur") )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
2>/dev/null | awk '{print $1}' )" -- "$cur" ) )
@@ -42,10 +29,4 @@ _pkg_config()
} &&
complete -F _pkg_config pkg-config
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
# ex: ts=4 sw=4 et filetype=sh