Replace optimist arguments parsing framework with yargs. Closes #1843

[yargs](https://github.com/chevex/yargs#yargs) is the [official successor of optimist](https://github.com/substack/node-optimist#deprecation-notice). It is actively maintained, does not have any dependencies and is available in version 1.3.1.