This should be possible with peek-stream. The idea is to make the input format (--read/-r) optional or at least let users set it to auto in order to sniff the input and detect different formats.
For CSV we could use csv-sniffer, or at least riff off what it does. For JSON this should be simple: the presence of a [ or { at the beginning of the input should be enough of a clue, though distinguishing between newline-delimited JSON might be trickier.
This should be possible with peek-stream. The idea is to make the input format (
--read
/-r
) optional or at least let users set it toauto
in order to sniff the input and detect different formats.For CSV we could use csv-sniffer, or at least riff off what it does. For JSON this should be simple: the presence of a
[
or{
at the beginning of the input should be enough of a clue, though distinguishing between newline-delimited JSON might be trickier.