4 ms·
I wonder how world would look like if all standard unix tools gave two outputs: human readable and structured, json-like.
by artemonster 5y ago
I wonder how world would look like if all standard unix tools gave two outputs: human readable and structured, json-like.
- wayoutthere 5y agoThen it would be PowerShell.
- disgruntledphd2 5y agoBut with shorter command names, and gnomic short options.
- laumars 5y agoNo. Powershell is a whole new CLI user land as well as a shell. If you want something that’s compatible with POSIX but still has smart pipelines and native support for JSON then you’re better off with Elvish or Murex as shells.
- xorcist 5y agoPerhaps take git as an example instead, with its plumbing and porcelain commands. They have historically been easier to keep backwards compatibility with than the dict-like structures of json.
- rnestler 5y agoI'd recommend to take a look at https://www.nushell.sh/ https://www.nushell.sh/ which has structured output, but displays it neatly when printing to the terminal.
- Kim_Bruning 5y agoYou don't need to wonder, because jc is a filter that does just that! https://kellyjonbrazil.github.io/jc/ https://kellyjonbrazil.github.io/jc/
- robert_tweed 5y agoIt even claims to parse ls output correctly (see caveat): https://kellyjonbrazil.github.io/jc/docs/parsers/ls https://kellyjonbrazil.github.io/jc/docs/parsers/ls
- kortex 5y ago> >>> import jc.parsers.dig I think "jc" stands for "jesus christ!" because I just exclaimed that out loud thinking about the amount of time I've wasted trying to parse dig outputs, or something similar. Spent a nontrivial amount of time looking for lightweight tools to convert the typical "fwf" of coreutils style programs. Definitely running "pipx install jc" immediately (pipx is great for managing python-based executable programs, avoid the mess of venvs).
- deleted 5y ago[deleted]
- int_19h 5y agoFreeBSD is trying for something like that. https://libxo.readthedocs.io/en/latest/ https://libxo.readthedocs.io/en/latest/