Closed vlandham closed 8 years ago
Preliminary work with the counts
function makes me think we can fix this by using:
default=click.open_file('-')
This uses click's open_file helper to open up standard in as the default input. According to the docs, this also autocloses the handle, so there aren't any negative side effects.
the full argument specification would be something like:
@click.argument('tokens', type=click.File('r'), default=click.open_file('-'))
With this in place, both -
and non dash piping seems to work fine.
textkit text2words test_data/alice.txt | textkit count --limit 3
",",2418
the,1516
',1127
textkit text2words test_data/alice.txt | textkit count --limit 3 -
",",2418
the,1516
',1127
Please! The dash annoys me. It feels more unixy to not require it, tbh. Good idea!
The dash is frequently used in unix commands to refer to standard in/out . But it is really really easy to miss.
If at all possible, it would be great to default to standard in if no input argument is given for many of the functions.