CLI testability improvements + more tests

- Moved several codeparts out of run() function and into separate
functions.
- Added --help and --version support (was broken)
- Moved releasedate into constant
- Added various unittests for CLI