4 ms·
What if we added json output mode to all shell commands? Or at least make some wrappers that parse their unstructured text output into json. We would be able t
by stackedinserter 5y ago
What if we added json output mode to all shell commands? Or at least make some wrappers that parse their unstructured text output into json.
We would be able to use standard pipelines and jq to filter/query outputs, without any custom shells.
Just imagine:
ifconfig --json | jq '.[] | [.interface, .inet] | @tsv'
- talideon 5y agoYou're not the first person to think of that. See Juniper's libxo: https://github.com/Juniper/libxo https://github.com/Juniper/libxo It's integrated into a lot of FreeBSD's command line tooling, and is very useful, when it's available.
- edwinyzh 5y agoSo a lot of FreeBSD command line tools support JSON output? That's cool! And I wish it was linux...
- dmytrish 5y agoThere is some movement in this direction: e.g. it's possible to do `ip -j addr` today.
- e12e 5y agoI am with you in principle - but I still don't get the jq path/filter syntax I'm afraid. I think I'd vastly prefer map/reduce/zip commandlets... Ed: I'd say from a quick glance that I think I rather prefer nushell to powershell