a 'pythonic' fileinput module for the D programming language
When I write small command line utilities in Python, I often take advantage of the fileinput module that makes working with text files very convenient: the library permits to write quickly and easily a loop over standard input or a list of files, something like
perl -a or awk line processing.
Then the size of input data grew, and also for a language comparison, I wanted to port my utility in the D programming language, but I cannot find an equivalent module, so I decided to write one myself.
The usage is pretty similar to Python:
Once compiled, this will lead to an executable that can accept any number of text file as input, or read from stdin and seamlessly iterate on all of the lines contained in every file.
Thanks to the range interface; every struct / class implementing these methods can be used in a foreach statement.
You can find the full implementation on github