4 ms·
--jp is a perfect fit for shell scripting integration: bash$ curl ... --jp "foo=$foo" ... This has zero shell-quoting, expansion, escaping, or separator i
by floatingatoll 5y ago
--jp is a perfect fit for shell scripting integration:
bash$ curl ... --jp "foo=$foo" ...
This has zero shell-quoting, expansion, escaping, or separator issues. Whatever's in environment variable `foo` will be sent to the server as a single value associated with key `foo`, whether it's a zero-length empty string, or full of backslashes or spaces or newlines or whatever.
There are fancier ways to accept multi-arg, but they all have weaknesses, and this matches the way curl handles -H arguments already today (one per header, stack them if you want many), so I think it's a sound way to handle CLI arguments.
(I don't have any specific views on whether this is how curl should do JSON or not, but I recognized the CLI safety mechanism immediately.)
- liquidify 5y agoDoes this handle nesting? I tend to do a lot of nesting in json. Almost always.
- floatingatoll 5y agoI certainly hope not!
- jcul 5y agoYes, if you click through to the wiki page there are examples of nested lists, maps.
- Siira 5y agoThen it will need quoting the metacharacters used for nesting.