Allow `--output` to be directory (#546)