What is very weird to me is that it appears to me that I have to add a case clause for every possible combination of options I’m going to have on the command line, and that is obviously not right.
Can anybody explain to me how to do this efficiently, maybe with an example of a project that solves this “problem” idiomatically, so I can learn? In Ruby I’m used to Thor (https://github.com/erikhuda/thor) which does a very good job at it, is there anything similar in Elixir?
Ok, OptionParser.parse/2 does return a tuple of type {parsed, argv, errors}, parsed is a synonym for Keyword.t, so lets take a look at the Keyword-module, which does have a lot of stuff available.
(Discourse did a bad job getting that line number…)
Won’t that expression on line 22 only parse through the options once, although it may work here since OptionParser has :help passed in first (I am unsure, but if the user passes in --from “blah” --help it could cause an issue that way?), it really should be iterated over or, in this case, the Keyword module should be used.