December is here, and that means that it’s time for Advent of Code. I’ve adopted Swift Argument Parser in my repo of attempts so I can run one of my solutions with something like
swift run AdventOfCodeRunner --year 2020 --day 5.
I have multiple years in here as I go and re-add older puzzles, and what I would really like to do is be able to run something like this:
swift run AdventOfCodeRunner --year 2015 --day 1 --day 2 --year 2020 --day 1 --day 2
This would parse to a Dictionary of type [Int: [Int]], where the key is the year and the value is an array of days. Is there a straightforward way to do this that I’m missing or am I going to have to parse everything manually?