Hacker News new | past | comments | ask | show | jobs | submit login

Something relatively simple would be borrowing the idea of the HTTP "accepts" header, and standardizing on an environment variable. For example:

    STDOUT_ACCEPT=application/json,application/csv,text/plain
I'm not sure how the application could easily communicate back the understanding of this, though -- basically the equivalent of HTTP Content-Type header. It would need to be done in a way that doesn't break other applications that aren't expecting it, perhaps such as being sent back on STDERR with an escape sequence of sorts?

The other trick is knowing what an application will accept via STDIN - ideally at runtime, but before actually writing anything.

If the shell understands all this, it could automatically format JSON/csv output for display, integrate jq for formatting, or even convert between formats (eg: when one app writes in yaml, the other understands JSON input).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: