> Take a list of files for example. you can run ls -l in a terminal and it will attempt a crude text based formatting of the output. or you can run a full gui filemanager.
ls's output (and a few other programs') are human facing. They're not meant to be machine readable.
> what if there was a command that would produce ls output as a table data structure, run in a sort of terminal that knows how to format a table nicely without the ls command having to include any formatting instructions? this terminal would have support for all sorts of data types and structures to display all of them nicely.
Because that's just complexity for its own sake. What's simpler is to just create a shell alias for a particular view you want. The shell is for interactive usage, with some capabilities for automation. If something better is needed, you write a real program for it.
ls's output (and a few other programs') are human facing. They're not meant to be machine readable.
many shell scripts are using ls as input. maybe a better example is ps. that's even more common i would guess.
the goal that i am proposing is to separate output and presentation. that is way more powerful. make commands with machine readable output, and add a presentation layer that converts that to something human readable.
for backwards compatibility you could call that command "show" so you would have
where every step except the output at the end deals with machine readable data.future terminals could skip the "show" step and read and format the machine output directly with all the power that this gets you such as the ability to reorder or resize columns, change the sorting order, etc, for the ls case like a gui filemanager, but commandline driven and able to handle any output of any command.
create a shell alias for a particular view you want
which shell alias lets me easily reorder or remove columns from ls or ps output? or change the sorting order with a single key press (like top does for example)
top/htop is a good example btw: it's an interactive interface for the output of ps.
imagine you could do the same thing by just running ps or ps | show? generic enough that it works for most commands producing structured data?