Should "-" work as an output file?
Right now, using - in place of an output file fails, at least when using it with seqscore count.
Starting with just references.bio:
> ls -a
. .. references.bio
Running this:
for outfile in "counts.tsv" "-"
do
seqscore count --labels BIO references.bio $outfile
done
produces two files that are the same:
> ls -a
- . .. counts.tsv references.bio
> sha256sum "./-" counts.tsv
5fba369692a43addad802d8c02592f1fcfdd0230c0129a11524199eba170d839 ./-
5fba369692a43addad802d8c02592f1fcfdd0230c0129a11524199eba170d839 counts.tsv
as opposed to - redirecting to stdout. Is this intentional? Is there a reason to not support -?
FWIW, I believe this can be fixed by adding a type=click.Path(...)-style annotation on L182 here.
@j0ma and I talked about this in person when the issue was opened, but I never memorialized it here. In short, this is a desirable feature, but it's not simple to add. We have to handle the file encoding properly, and also some functions operate on paths only, so special logic would have to be added in for '-'. But it's worth doing for output files for scoring, count, etc. for sure.
OK I thought of this issue first thing this morning for some reason. Would it be enough to handle the encoding + file opening using a combination of click.Path(..., allow_dash=True) and click.open_file? There's also click.echo that can be a substitute for printing to a file