Pretty good little refactor.

Pulling two traits out of test code and adding them into main so that they can be reused.
Giving encoding detection a better return type.
Decoupling CommandLineParsing from DocumentReading.