refactoring and tests of buildslave cli commands code

Refactored buildslave.scripts.runner code to have a style that is closer to the style of buildbot.scripts.runner. Fixed a [minor bug](https://github.com/elmirjagudin/buildbot/commit/191e2662c74a86cc327fe5f53690f95b995c3ca5) and added more unit tests.