Skip to content

Conversation

ArtOfCode-
Copy link

As it says on the tin. Adds a -stdout option 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.

Comment on lines +72 to +74
if !writeStdout {
fmt.Printf("Creating size %v avatar for hash %v, writing into %v\n", size, hash, outfile)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@balpha
Copy link
Owner

balpha commented Aug 28, 2021

Hey, the first unicornify PR 🎉

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