charmbracelet / freeze

Generate images of code and terminal output 📸
MIT License
3.24k stars 55 forks source link

feat(#58): write to stdout if not `tty` #102

Open AlejandroSuero opened 4 months ago

AlejandroSuero commented 4 months ago

When piping the command like freeze png.go | pbcopy it will write to the stdout.

Like @maaslalani said, when not tty it will write to stdout.

Demo

https://github.com/charmbracelet/freeze/assets/71392160/c7e93918-10d8-4862-bba8-3cd9949a2d5a

AlejandroSuero commented 4 months ago

In this demo I show how the current freeze png.go > out.txt won't write correctly to stdout when piped and how this PR's changes makes it possible to do it.

https://github.com/charmbracelet/freeze/assets/71392160/05266c30-86f5-4577-8ba0-5e971e452de1