Fixes --output option
Adds further cli integration tests