charmbracelet / freeze

Generate images of code and terminal output 📸
MIT License
2.98k stars 50 forks source link

feat(#112): Support nonzero execute exit codes via `--execute-non-zero` #113

Open TylerJang27 opened 4 weeks ago

TylerJang27 commented 4 weeks ago

Adds a --execute-non-zero flag that, when set, doesn't error when a --execute commands has a nonzero exit code. This allows you to capture the output of commands that are expected to nonzero exit, such as mkdir ., as a toy example.

Please let me know if there's anything else you'd like me to change in this PR!

Fixes https://github.com/charmbracelet/freeze/issues/112

gewenyu99 commented 4 weeks ago

We need this!

ccoVeille commented 4 weeks ago

this is usually coded with --exit-code that default to 1, if someone wants 0 they can use it

TylerJang27 commented 4 weeks ago

@ccoVeille could you clarify? Do you mean instead of --execute-non-zero change this to --exit-code (default to 0), which someone would override to --exit-code=1?

ccoVeille commented 4 weeks ago

I misunderstood what you implemented, I'm sorry. I will let you decide if there is still a need.

git, golangci-lint do like this. And many more.

https://github.com/search?q=language%3Amarkdown+%22--exit-code%22&type=code

I find the parameters more obvious than defining something by its opposite.

But your need is different

maxandersen commented 3 weeks ago

literally just hit this - was pretty sad when i realized I couldn't use freeze to "screenshot" error output.