3 ms·
Why not just pipe into a python program that uses a mature JSON parser? These “*q” things are really boring.
by pipeline_peak 5y ago
Why not just pipe into a python program that uses a mature JSON parser? These “*q” things are really boring.
- eatonphil 5y agoIs go's json parser less mature than python's?
- pipeline_peak 5y agoI was under the assumption that this thing is using it's own parser, I guess it doesn't, idc. The point I'm trying to make is that JQ depends on the user investing the time to know an esoteric domain language. This thing is fed by Go scripts that get interpreted, at that rate just use a powerful shell language like Python.
- tedunangst 5y agoWhat if I'm more familiar with go and python is an esoteric language?
- pipeline_peak 5y agoIn the world of shell scripts, python isn't an esoteric language....
- joshbaptiste 5y agobecause many folks just want a single binary and not a full language library
- pipeline_peak 5y agoIf you are using whateverq and writing a shell script, everyone else using it needs to have whateverq installed as well....
- sidpatil 5y agoUnless you bundle the whateverq alongside the shell script. Which is a primary design advantage of single small statically-built binaries.
- pipeline_peak 5y agoThat's true, but isn't that kind of a hassle on both sides?
- adolph 5y agoJust encode and append the binary to the script: https://unix.stackexchange.com/questions/450614/is-there-a-way-to-embed-an-executable-binary-in-a-shell-script-without-extra-too https://unix.stackexchange.com/questions/450614/is-there-a-w...
- wpietri 5y agoYou could use the same logic to ask yourself why there should be any command-line tools at all, just python libraries. Python is my daily driver, but I still use JQ when I'm doing something quick. If you try some complex examples, I'd bet you'll quickly figure out why.
- sleepybrett 5y agoWhy do I want to bloat my pipeline container with a fucking python install including all the libraries? I'd rather pop a single tiny binary in there. Container bloat = slower pipelines.
- pipeline_peak 5y agoIf you’re working in a Unix environment within a container isn’t there a high likelihood there already is Python as well? I never said every single library, also Python scripts can run as standalone executables. If you truly can’t have Python because it’s too bloated, then JQ in shell scripts is a fair use case, that just sounds so rare.
- adolph 5y agoTrue, high likelyhood there is _a_ Python but maybe not the Python your script needs. The situation is better nowadays but 2.7 persisted for a really long time.