Fixes so we can still run the commands directly

- Add __name__ == '__main__' bits so we can still test easily
- Move optparser errors where they will actually work
- Restore exit code functionality on grok-pull
5 files changed