Add option to write to STDOUT#1
Open
ArtOfCode- wants to merge 1 commit into
Open
Conversation
balpha
reviewed
Aug 28, 2021
Comment on lines
+72
to
+74
| if !writeStdout { | ||
| fmt.Printf("Creating size %v avatar for hash %v, writing into %v\n", size, hash, outfile) | ||
| } |
Owner
There was a problem hiding this comment.
I think we should just send this to stderr instead of disabling it. Not sure why I sent this to stdout and the rest to stderr -- it should all go to stderr.
| flag.BoolVar(&noshading, "noshading", false, "do not add shading, this will make unicorns look flatter") | ||
| flag.BoolVar(&nograss, "nograss", false, "do not add grass to the ground") | ||
| flag.BoolVar(&serial, "serial", false, "do not parallelize the drawing") | ||
| flag.BoolVar(&writeStdout, "stdout", false, "write image to STDOUT") |
Owner
There was a problem hiding this comment.
If we change the info message (see my other comment) to go to stderr instead of stdout, then it seems like this option isn't necessary anymore, since you can specify stdout as the outfile.
At least on my machine, this works fine:
$ ./go-unicornify -r -o /dev/stdout
What do you think?
Owner
|
Hey, the first unicornify PR 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As it says on the tin. Adds a
-stdoutoption to allow writing images to STDOUT instead of to file (the use case in mind here is a direct reverse proxy via something like nginx, rather than write/read file-based). Also removes the progress text if this option is specified so that the image doesn't get corrupted.