Open yschimke opened 5 years ago
I'm mainly suggesting this as this is code I've built myself but used in multiple apps. Definitely one to close if it's not useful, but for various CLIs being able to have an API to show output to users and use the highest fidelity representation.
Example output in iTerm
src/test/kotlin/commands/tweetsearch.kts Pusheen
src/test/kotlin/commands/uberprices.kts Buckingham Palace
All of these look very cool! I need some time to look into this in more detail. (Reminds me a bit of Windows Terminal https://github.com/microsoft/terminal/issues/448, that also opens some exciting possibilities.) Definitely interested in providing tight integration with advanced shells.
iTerm inline images: https://www.iterm2.com/documentation-images.html (also implemented by MinTTY)
Further reading:
Some code from my own libraries that could be useful if you want richer terminal integration.
Launching preview apps
https://github.com/yschimke/oksocial-output/blob/master/src/main/kotlin/com/baulsupp/oksocial/output/OsxOutputHandler.kt
Json pretty printing
https://github.com/yschimke/oksocial-output/blob/master/src/main/kotlin/com/baulsupp/oksocial/output/ConsoleHandler.kt
Image support (e.g. iTerm2)
https://github.com/yschimke/oksocial-output/blob/master/src/main/kotlin/com/baulsupp/oksocial/output/iterm/ItermOutputHandler.kt