* [PATCH] _jq: New completion.
@ 2017-10-09 0:17 Daniel Shahaf
2017-10-09 0:23 ` Daniel Shahaf
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2017-10-09 0:17 UTC (permalink / raw)
To: zsh-workers
---
Completion/Unix/Command/_jq | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 Completion/Unix/Command/_jq
diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq
new file mode 100644
index 000000000..24eb4cf52
--- /dev/null
+++ b/Completion/Unix/Command/_jq
@@ -0,0 +1,32 @@
+#compdef jq
+
+# last updated for jq-1.5-1-a5b5cbe (debian package 1.5+dfsg-1.3)
+
+# Note:
+# Arguments to options must be in separate words. Thus,
+# {-f,--from-file}'[foo]'
+# is correct like that, without the usual {-f+,--from-file=} suffixes.
+#
+_arguments -S -s : \
+ "--version[output jq's version number]" \
+ "--seq[use application/json-seq ASCII RS/LF scheme in input and output]" \
+ "--stream[parse input streamily (changes output)]" \
+ '(-s --slurp)'{-s,--slurp}'[join input JSON objects to array before filtering]' \
+ '(-R --raw-input)'{-R,--raw-input}'[consider each input line as a JSON strings]' \
+ '(-n --null-input)'{-n,--null-input}'[input is ignored]' \
+ '(-c --compact-output)'{-c,--compact-output}"[don't pretty-print]" \
+ '(--indent)--tab[indent output using TAB characters]' \
+ '(--tab)--indent[indent output using given number of spaces]:number of spaces (integer):(2 4 8)' \
+ '(-C --color-output -M --monochrome-output)'{-C,--color-output}'[output in color]' \
+ '(-C --color-output -M --monochrome-output)'{-M,--monochrome-output}'[output without color]' \
+ '(-a --ascii-output)'{-a,--ascii-output}'[restrict output to ASCII]' \
+ '--unbuffered[flush output after each JSON object]' \
+ '(-S --sort-keys)'{-S,--sort-keys}'[output object keys in sorted order]' \
+ '(-r --raw-output -j --join-output)'{-r,--raw-output}"[don't JSON-quote output if it's a string]" \
+ '(-r --raw-output -j --join-output)'{-j,--join-output}"[like -r, without newlines between outputs]" \
+ '(-f --from-file)'{-f,--from-file}'[read filter from file]:_files' \
+ '-L+[prepend a directory to the module search path]:_directories' \
+ '(-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'
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] _jq: New completion.
2017-10-09 0:17 [PATCH] _jq: New completion Daniel Shahaf
@ 2017-10-09 0:23 ` Daniel Shahaf
2017-10-09 9:53 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2017-10-09 0:23 UTC (permalink / raw)
To: zsh-workers
Daniel Shahaf wrote on Mon, 09 Oct 2017 00:17 +0000:
> +_arguments -S -s : \
> + '*--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'
I'll add a specification for positional arguments:
"1:filter" "*:input files:_files"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] _jq: New completion.
2017-10-09 0:23 ` Daniel Shahaf
@ 2017-10-09 9:53 ` Oliver Kiddle
2017-10-09 13:35 ` Daniel Shahaf
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2017-10-09 9:53 UTC (permalink / raw)
To: Daniel Shahaf; +Cc: zsh-workers
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.
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] _jq: New completion.
2017-10-09 9:53 ` Oliver Kiddle
@ 2017-10-09 13:35 ` Daniel Shahaf
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2017-10-09 13:35 UTC (permalink / raw)
To: zsh-workers
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"
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-09 13:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 0:17 [PATCH] _jq: New completion Daniel Shahaf
2017-10-09 0:23 ` Daniel Shahaf
2017-10-09 9:53 ` Oliver Kiddle
2017-10-09 13:35 ` 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).