Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] _jq: New completion.



Oliver Kiddle wrote on Mon, 09 Oct 2017 11:53 +0200:
> Daniel Shahaf wrote:
> > I'll add a specification for positional arguments:
> >
> >      "1:filter" "*:input files:_files"
> 
> For the filter, it'll need to use _guard otherwise it'll block
> completion of options where an unambiguous option prefix has been
> specified.

Good catch.  Interdiff:

diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq
index 24eb4cf52..55bb93c04 100644
--- a/Completion/Unix/Command/_jq
+++ b/Completion/Unix/Command/_jq
@@ -29,4 +29,6 @@ _arguments -S -s : \
   '(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \
   '*--arg[pre-set a variable to a string]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (string): ' \
   '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \
-  '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files'
+  '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \
+  "1: :_guard '|[^-]' filter" \
+  "*:_files"



Messages sorted by: Reverse Date, Date, Thread, Author