News for hackers. Stuff that matters.
Re:Conventions for Command Line Options by chriswarbo on Saturday August 01, 2020 @05:01PM (#24023869)
> For example, would you prefer a “find” command that uses environment variables instead of command line options?

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.

    find . -type f -a -not \( -name \*.htm -o -name \*.html \)
We can compare this to tools like 'jq', which use a DSL but keep it inside a single string argument:

    key=foo val=bar jq -n '{(env.key): env.val}'
Note that 'jq' also accepts key/value pairs via commandline arguments, but that requires triplets of arguments, e.g.

    jq -n --arg key foo --arg val bar '{(env.key): env.val}'
Re:Conventions for Command Line Options by pklo on Saturday August 08, 2020 @04:43AM (#24090106)
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 :(