sumgram icon indicating copy to clipboard operation
sumgram copied to clipboard

Make its input and output Linux pipe friendly

Open ibnesayeed opened this issue 6 years ago • 5 comments

The tool should accept input from the STDIN and generate output to the STDOUT so that it can work nicely with other Unix tools.

ibnesayeed avatar Nov 12 '19 17:11 ibnesayeed

+1

I also noted this with "scraper" in yesterday's telecon too.

phonedude avatar Nov 12 '19 18:11 phonedude

@ibnesayeed,

For a single text collection, this shouldn't be a problem.

However, for multiple text collections, we'd need an unambiguous boundary marker to determine the end of "text collection 1" and the beginning of another. When reading separate files, this is not a problem because the files serve as natural text collection boundaries.

For a single text collection, is this usage what you have in mind?: $ sumgram "The eye of Category 4 Hurricane Harvey..."

anwala avatar Feb 23 '22 21:02 anwala

For a single text collection, is this usage what you have in mind?: $ sumgram "The eye of Category 4 Hurricane Harvey..."

No, this style of argument was not the intent, because that would be ambiguous and no one wants to supply a long text as an argument. Please let the argument reserved for file/folder paths and use STDIN as input instead, so something like the following works:

$ echo "The eye of Category 4 Hurricane Harvey..." | sumgram

ibnesayeed avatar Feb 27 '22 20:02 ibnesayeed

FYI, many things that you trying to do with the input (e.g., reading from STDIN, one or more files as arguments, compressed files, etc.) can be handled more easily using the fileinput module in the standard Python library.

ibnesayeed avatar Feb 27 '22 20:02 ibnesayeed

Oh, I see, I misunderstood. Thanks a lot for the clarification. I'll ensure you can read text from STDIN & consider using fileinput.

anwala avatar Feb 27 '22 22:02 anwala