The second example didn't work for jq-1.6 ---I had to write it as
jq -n --arg key foo --arg val bar '{($key): $val}'
Re:Conventions for Command Line Options
by chriswarbo on Monday August 10, 2020 @11:12AM
(#24110106)
Yes you're right. I spotted it myself, but only after I couldn't edit anymore :(
I use 'find' so much that my muscle memory would hurt if it changed, but it's actually a really interesting example. Its use of arguments to build a domain-specific language is a cool hack, but pretty horrendous; e.g.
We can compare this to tools like 'jq', which use a DSL but keep it inside a single string argument: Note that 'jq' also accepts key/value pairs via commandline arguments, but that requires triplets of arguments, e.g.