Replacing optparse with Click. Untested and partial.