This repository has been archived by the owner on Apr 26, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*** BREAKING CHANGE *** This is a fairly large re-think of how argument values are fetched from the their various input sources. Before, values would be loaded during a step after parsing, where the matched usage branch would be completely unrolled, unified and then populated. This had the disadvantage that one could not tell which of the mutually exclusive branches produced a result, since one value might arrive from ARGV and another one from the [default: ...] tag, or the environment, etc. (See #8) Now, values are loaded at parse-time, removing these issues. Further, "empty" values are elided from the output, representing the user *not trying* to match these keys (as opposed to choosing to set them explicitly). For example, the user might pass the value 'false' to an option and that value will be retained. If the option however yields false because there was no user input and because 'false' is its' empty fall-back, the value will be omitted. The same goes for matching repeating elements into an array. At least one element needs to be matched before a value will be yielded. The diff of 'testcases.docopt' should highlight these changes better than any amount of explanatory text could. This patch also removes the "ScoredResult" type as it is no longer needed. Scoring is based on the "Origin" of a value now. This somewhat simplifies the code. Lastly, there's now a recursive step inside `genExhaustiveParser` that recursively evaluates missing elements until all options have been exhausted or failed.
- Loading branch information