Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: better control over script usage #87

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

debdutdeb
Copy link

@debdutdeb debdutdeb commented Apr 28, 2024

this is needed for when we want to write image to a pipe or socket and I can't just name it blabla.png.

this should fall back on using extension like before if format isn't specified.

treats the format also the same way it did before with extension. logic isn't touched.

what it adds -

  1. able to send output to stdout if not a tty (as already was), or by intention freeze main.go -o -
  2. specify format of the image when can't specify in destination, e.g. stdout writing

@debdutdeb debdutdeb marked this pull request as draft April 28, 2024 04:42
@debdutdeb debdutdeb marked this pull request as ready for review April 29, 2024 06:42
@debdutdeb debdutdeb changed the title chore: add format option instead of always deriving from extension chore: better control over non-interactive usage Apr 29, 2024
@debdutdeb debdutdeb changed the title chore: better control over non-interactive usage chore: better control over script usage Apr 29, 2024
@debdutdeb
Copy link
Author

debdutdeb commented Apr 29, 2024

since I touched some of the writing logic (logic is the same, unless I made a mistake), added respective tests to check behavior is consistent.

Only outlier is -o - change. That I mostly did to make it easy to test. I'm ok to remove that if it goes against charm's pr guidelines (mixing changes) which I may have missed.

edit: The pr name choice may have defeated me. I don't know a better name, suggestions are welcome

@maaslalani
Copy link
Contributor

I'm perhaps leaning towards outputting the file contents if stdout is not a tty.

@maaslalani
Copy link
Contributor

This could mean you could easily do stuff like:

freeze main.go | pbcopy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants