So far I haven’t seen any exercises which deal with opening and reading files or stdin or do argument parsing. This is a very common task when creating CLI tools and most languages have good support for this built in or in the standard library.
Would there be interest in me creating one or two exercises to cover this?
I suppose those would be concept exercises?
The tournament exercise’s story revolves reading input from files and writing formatted output, although the tracks I’ve seen implement it generally give you a string representing the input file’s contents and expect you to return a formatted string.
It’s a tad complicated to implement and simulate the file I/O in a way that’s consistent between the website and multiple platforms where the CLI is used (and for Windows, there is the “slash vs backslash” issue). For Python, we went with text that’s part of the test file … so we’re really not doing any file I/O,
We could likely mock it with PyTest, but it’s involved and we have a bunch of other exercises (time, error handling, generators, the remainder of the syllabus, etc., etc.) we feel are more important to fluency, and so ahead of things in the TODO queue.
I’d imagine that other tracks might have even bigger issues depending on how the languages handle cross-platform file I/O, and how the test packages handle mocking.