zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] _pkg-config: Complete variables for --variable.
@ 2016-07-22  7:20 Daniel Shahaf
  2016-07-22  7:20 ` [PATCH 2/2] _pkg-config: Add options, complete *.pc files for positional arguments Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2016-07-22  7:20 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_pkg-config | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config
index e44b368..54955eb 100644
--- a/Completion/Unix/Command/_pkg-config
+++ b/Completion/Unix/Command/_pkg-config
@@ -20,7 +20,7 @@ arguments=(
       "--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"
+      "--variable=[return the value of the specified variable]:variable:->variable"
       "--define-variable=[set the global value for a variable]:name value pair"
       "--uninstalled[return success if any \"-uninstalled\" packages are being used]"
       "--exists[test whether the package exists or not]"
@@ -33,11 +33,23 @@ arguments=(
       "*: :->packages"
 )
 
-_arguments -C $arguments && ret=0
+_arguments -C -S : $arguments && ret=0
 
-if [[ -n $state ]] ; then
-  packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} )
-  _wanted packages expl 'package' compadd -a - packages && ret=0
-fi
+case $state in
+  (packages)
+    packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} )
+    _wanted packages expl 'package' compadd -a - packages && ret=0
+  ;;
+
+  (variable)
+    if [[ $line[1] != '-' ]]; then
+      local -a variables=( ${${(f)"$(_call_program variables "pkg-config --print-variables -- ${(q)line[1]}")"}} )
+      _wanted variables expl 'variable' compadd -a - variables && ret=0
+    else
+      _message "variable"
+    fi
+    ;;
+
+esac
 
 return ret


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] _pkg-config: Add options, complete *.pc files for positional arguments.
  2016-07-22  7:20 [PATCH 1/2] _pkg-config: Complete variables for --variable Daniel Shahaf
@ 2016-07-22  7:20 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2016-07-22  7:20 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_pkg-config | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config
index 54955eb..9bd411d 100644
--- a/Completion/Unix/Command/_pkg-config
+++ b/Completion/Unix/Command/_pkg-config
@@ -3,12 +3,15 @@
 local arguments packages curcontext="$curcontext" state line ret=1
 declare -A opt_args
 
+# Up-to-date as of pkg-config 0.29-4 (debian package) man page synopsis
 arguments=(
       "--modversion[print the version information of a given package]"
+      "--version[print version information of pkg-config itself]"
       "--atleast-pkgconfig-version=[require given version of pkg-config]:minimum version"
       "(- *)"{--help,-\?}"[display a help message]"
       "(- *)--usage[display brief usage message]"
       "--print-errors[cause errors to be printed]"
+      "--short-errors[print short error messages]"
       "--silence-errors[prevent the printing of errors]"
       "--errors-to-stdout[print errors to stdout rather than stderr]"
       "--cflags[print the preprocessor and compiler flags]"
@@ -19,14 +22,19 @@ arguments=(
       "--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]"
+      "--validate[syntax check a .pc file]"
       "--list-all[list all known packages]"
       "--variable=[return the value of the specified variable]:variable:->variable"
       "--define-variable=[set the global value for a variable]:name value pair"
+      "--print-variables[list all variables defined in the package]"
       "--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"
+      "--print-provides[list all modules the package provides]"
+      "--print-requires[list all modules the package requires]"
+      "--print-requires-private[list all modules the package requires for static linking (see --static)]"
 #      "--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"
@@ -38,7 +46,10 @@ _arguments -C -S : $arguments && ret=0
 case $state in
   (packages)
     packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} )
-    _wanted packages expl 'package' compadd -a - packages && ret=0
+    _alternative \
+      'packages:package:compadd -a - packages' \
+      'files:package file:_files -g "*.pc"' \
+      && ret=0
   ;;
 
   (variable)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-22  7:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22  7:20 [PATCH 1/2] _pkg-config: Complete variables for --variable Daniel Shahaf
2016-07-22  7:20 ` [PATCH 2/2] _pkg-config: Add options, complete *.pc files for positional arguments Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).