Add --output option

Output to file feature was buggy.