spring-shell icon indicating copy to clipboard operation
spring-shell copied to clipboard

Make shell stream type aware

Open jvalkeal opened this issue 2 years ago • 0 comments
trafficstars

It looks like with new overhauled terminal provider system in JLine it might be possible to get more accurate info what type of streams stdin/stdout/stderr are. We have some very limited support around this but only for styling. It relies on a common hack that JLine uses DumpTerminal in cases when there's no "user". This hack has always been a bit "dump".

Usually this is used to automatically make a choice what to output if user runs a command vs. redirects output into a file or pipes it to somewhere else. Printing to a terminal screen is usually for a user's eyes to see and can be formatted, however piping to a file usually means it's meant for some program to consume.

It'd be nice if some random list of objects could be automatically shown as table data with coloured output in a screen but in a file that'd be i.e. json/csv/whatever.

For example how ls works:

image

jvalkeal avatar Nov 03 '23 09:11 jvalkeal