Skip to content

Add option to write to STDOUT#1

Open
ArtOfCode- wants to merge 1 commit into
balpha:mainfrom
ArtOfCode-:art/write-to-stdout
Open

Add option to write to STDOUT#1
ArtOfCode- wants to merge 1 commit into
balpha:mainfrom
ArtOfCode-:art/write-to-stdout

Conversation

@ArtOfCode-

Copy link
Copy Markdown

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 thread main.go
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
Copy Markdown
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.

Comment thread main.go
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
Copy Markdown
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

balpha commented Aug 28, 2021

Copy link
Copy Markdown
Owner

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