Add a config parser to the command parser

Passing the config by parameter rather than using a global state as is
it usually done allows for easier testing and less coupled code.