jcsalterego / pngpaste

Paste PNG into files, much like pbpaste does for text.
Other
477 stars 32 forks source link

Add -f option: force output to standard output #4

Closed betaveros closed 10 years ago

betaveros commented 10 years ago

It's a good idea to avoid dumping binary to the console, but I added a flag to override it so I can use it as a process with an output stream from a program (I'm using it as a terrible workaround for this Java bug.)

It wasn't obvious to me what letter to use for the option, and these are the first lines of Objective-C code I've ever written; I hope it's satisfactory.

jcsalterego commented 10 years ago

Thanks for this PR. As a convention, the UNIX way is to use - to represent stdin or stdout, e.g.:

$ pngpaste -

I would probably have a constant called kStdoutFilename and then perform an equality comparison before writing the file to stdout with [(NSFileHandle*)[NSFileHandle fileHandleWithStandardOutput] writeData:pngData];.

I am currently blocked by an environment which can properly compile things (yay Mavericks), but am working to remedy that soon.

betaveros commented 10 years ago

That's odd, I'm on Mavericks too and it works like a charm.

jcsalterego commented 10 years ago

It's a problem with my environment, unfortunately.

jcsalterego commented 10 years ago

This feature has been implemented slightly differently in https://github.com/jcsalterego/pngpaste/commit/10435cf896bd7c068c365146781a2753bff27d9e. Usage is pngpaste - > awesome.png. Thanks!