Read file from stdin

closes #382 , also took the freedom of replacing optimist with [yargs](https://github.com/chevex/yargs) as optimist is no longer maintained.
Same as above.