This repository has been archived by the owner on Apr 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
felixSchl
force-pushed
the
feature/rich-output
branch
from
May 8, 2016 21:01
fadb985
to
6b49387
Compare
These new values contain the origin as well as the value (and possibly more later).
*** 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.
E.g: `-p` would not yield 5000 if `-x` was given: r""" Usage: foo ([-p PORT] -x [-f=d]) Options: -p PORT [default: 5000] """ $ prog -x {"-x": true, "-p": 5000}
felixSchl
force-pushed
the
feature/rich-output
branch
from
May 9, 2016 05:56
6b49387
to
c18d84c
Compare
These changes are coming through now and will be part of the next release with a minor version bump: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Going through PR motions for validation - will merge if there are no objections.
Fixes #8
https://felixschl.github.com/neodoc is featuring this behaviour right now for easy testing.
The latest commit message explains:
As for the tests (or see the files-changed view below):