Closed Prillan closed 7 years ago
Hey! Sorry, I didn't realize this PR was open. I will take a look at it this week.
I like this feature. I'll take a look and see if there is any obvious way to add tests for a command line feature.
This would definitely be helpful to me
@mplewis The easiest would probably by to send the arguments array and the output stream as arguments to main
, like this for the normal case main(sys.argv, sys.stdout)
and then something that you can control for the test cases. For output, change print(...)
to print(..., file=output)
.
I've never tried this myself and I don't know if it's the best way of doing it, but it works.
Thanks @Prillan – this looks good to me. I put together a shell script to test stdin functionality. I'll land that after merging this.
This makes it possible to do things like:
Or perhaps
The argument parser is modified to accept zero or more arguments with stdin (
'-'
) as default. Thus the following are equivalent,csvtomd
andcsvtomd -
. Using any other argument together with-
results in an error.