docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.04k stars 146 forks source link

Fixes option parsing on C++ libs that match EOL differently #136

Open ttuggle opened 4 years ago

ttuggle commented 4 years ago

The following fragment does not match between docopt.cpp and docopt:

Usage:
    myprog [options] <command> <arguments>...

Options:
  --reallylongoption <super_long_argument_description>
                This option fails to capture the argument on some
                C++ libs where $ does not match EOL.
                See https://stackoverflow.com/questions/39645660/stdregex-to-match-begin-end-of-string
                For some discussion and the inspiration to fix it by adding the \n.
ttuggle commented 4 years ago

FYI, this does include the code from https://github.com/docopt/docopt.cpp/pull/109

ttuggle commented 4 years ago

The pull request in https://github.com/docopt/docopt.cpp/pull/109 fixes problems parsing something like this, which does parse in Python.

usage:
    myprog [options] <file>

options:
    --fail      This arg unfortunately fails to process
                because there are two newlines preceeding
                the options section.