- Notifications
You must be signed in to change notification settings - Fork146
Empty lines do not break options sections.#52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There are several reasons why an options section can be split by anempty line, among them are:- logically grouping;- aesthetic reasons.Such style is used, for example, in 'man' program.An example: Options: --before-empty-lines An option before empty lines. --after-empty-lines An option after empty lines.
EVGVir commentedAug 1, 2016
It is possible to play with this new regular expressionhere. |
jaredgrubb commentedAug 2, 2016
Although I think there's merit to this request, adding this test-case causes the Python version of docopt to fail. One of the missions is to maintain feature parity across the variants of docopt. Can you post this in the docopt-py forum; if it's accepted there, then I can accept your patch as the port of that feature. |
EVGVir commentedAug 3, 2016
I have created apull request in the maindocopt repository. |
The proposed changes for docopt can be found in the pull request[339](docopt/docopt#339).
EVGVir commentedAug 4, 2016
Something went wrong with Boost regexs. Other tests are okay. |
The wildcard `.` matches any single character including the newlinecharacter in Boost.Regex. So, `[^\\n]` construction is used instead.
| "(?:^|\\n)("// A section begins at start of a line and consists of: | ||
| "[^\\n]*" + name +"[^\\n]*"// - a line that contains the section's name; and | ||
| "(?:"// - several | ||
| "\\n+[\\t][^\\n]*"// indented lines possibly separated by empty lines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I believe that there is a better solution for this issue. But that is how it looks like now, so I decided that it is okay to re-use this approach. After all, this issue must be addressed rather in a parallel pull request than in this one.
There are several reasons why an options section can be split by an
empty line, among them are:
Such style is used, for example, in
manprogram.An example: