8 comments

[ 3.6 ms ] story [ 32.3 ms ] thread
That @click library is a lot less lines of code than the equivalent argparse boilerplate. That's nice.

    > Take for example this one-liner:
    > [program listing...]
    > In this condensed program of 4 lines, the following happens:
Right a "one" liner I see...

once it gets above roughly 100 characters you are no longer allowed to call it a "one liner"

and style note putting the pipe"|" at the end of the command instead of the beginning acts as a natural break and lets you avoid the backslash escaped newline nonsense.

    curl ... |
    jq ... |
    awk ....
vs

    curl ... \
    | jq ... \
    | awk ...
If we're nitpicking the number of lines, I'm way more confused because there is no obvious way that I can see for that to be 4 lines. Either it's a (very long) one liner, or it is as rendered a 5 line example (with the lines starting with curl, jq, sqlite3, sqlite3, and xargs). Where is 4 coming from?

(To be clear, this sounds like a complaint, and it kind of is, but I think the article is actually quite good if we just ignore that one basically irrelevant detail)

TIL about the pipe/newline, thanks. Edited.
Many of us are no doubt just waiting for the webmaster of www.example.com to realize that there's a marvellous Bobby Tables SQL injection exploit in there. (-:

Being a good neighbour involves a bit more than reading from standard input and being about to send JSON to standard output; and there's more to be said about the field parsing, including that fields must not contain interior whitespace, for which vis(1) encoding is a good idea.

> Many of us are no doubt just waiting for the webmaster of www.example.com to realize that there's a marvellous Bobby Tables SQL injection exploit in there. (-:

Thankfully, there'll never be one!

https://en.wikipedia.org/wiki/Example.com