DRY non-option argument-handling logic and fix -o option in the process