about summary refs log tree commit diff
path: root/Completion/Unix/Command/_pkg-config
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-14 23:03:40 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-14 23:04:45 +0200
commit13fc579343b24d298fb8905933b6000d7fcda114 (patch)
treecbc1000696357438714107635f93166bcab76d3a /Completion/Unix/Command/_pkg-config
parent66320ca93a717467a0ed0d34da4c06257953aa50 (diff)
downloadzsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.gz
zsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.xz
zsh-13fc579343b24d298fb8905933b6000d7fcda114.zip
33467: correct return status on functions and numerous other minor fixes
Diffstat (limited to 'Completion/Unix/Command/_pkg-config')
-rw-r--r--Completion/Unix/Command/_pkg-config24
1 files changed, 13 insertions, 11 deletions
diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config
index 48b788a1b..e44b36897 100644
--- a/Completion/Unix/Command/_pkg-config
+++ b/Completion/Unix/Command/_pkg-config
@@ -1,6 +1,6 @@
 #compdef pkg-config
 
-local arguments packages curcontext="$curcontext" stat line
+local arguments packages curcontext="$curcontext" state line ret=1
 declare -A opt_args
 
 arguments=(
@@ -11,31 +11,33 @@ arguments=(
       "--print-errors[cause errors to be printed]"
       "--silence-errors[prevent the printing of errors]"
       "--errors-to-stdout[print errors to stdout rather than stderr]"
-      "--cflags[prints the preprocessor and compile flags]"
+      "--cflags[print the preprocessor and compiler flags]"
       "--cflags-only-I[output -I flags only]"
       "--cflags-only-other[output cflags not covered by the cflags-only-I option]"
       "--debug[show verbose debug information]"
-      "--libs[prints the link flags]"
-      "--libs-only-L[prints the -L and -R parts of \"--libs\"]"
-      "--libs-only-l[prints the -l part of \"--libs\"]"
+      "--libs[print the link flags]"
+      "--libs-only-L[print the -L and -R parts of \"--libs\"]"
+      "--libs-only-l[print the -l part of \"--libs\"]"
       "--libs-only-other[output other libs]"
       "--list-all[list all known packages]"
       "--variable=[return the value of the specified variable]:variable"
       "--define-variable=[set the global value for a variable]:name value pair"
-      "--uninstalled[return successfully if any \"-uninstalled\" packages are being used and fails otherwise]"
-      "--exists[tests whether the package exists or not]"
+      "--uninstalled[return success if any \"-uninstalled\" packages are being used]"
+      "--exists[test whether the package exists or not]"
       "--atleast-version=[test whether the version is at least that of the specified value]:least value"
       "--exact-version=[test whether the version is exactly that of the specified value]:exact value"
       "--max-version=[test whether the version is no greater than some specific value]:max version"
 #      "--msvc-syntax[output linker flags in a form compatible with MSVC++ (Windows only)]"
 #      "--dont-define-prefix[disables automatic overiding of the variable \"prefix\" (Windows only)]"
 #      "--prefix-variable=[set the name of the variable \"prefix\" (Windows only)]:prefix value"
-      "*:package name:->package"
+      "*: :->packages"
 )
 
-_arguments -C $arguments
+_arguments -C $arguments && ret=0
 
 if [[ -n $state ]] ; then
-    packages=( ${(f)"$((pkg-config --list-all | cut -d' ' -f1) 2>/dev/null)"} )
-    compadd -a - packages
+  packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} )
+  _wanted packages expl 'package' compadd -a - packages && ret=0
 fi
+
+return ret