docopt/docopt.cpp

Late error detection 2

janwilmans opened this issue · 1 comments

In this example, -d is forgotten in the Usage section, but it is listed later, in the options section, when you actually try to use the -d option, it complains:

Unexpected argument: -d, test
R"(DebugviewConsole )" VERSION_STR
R"(
    Usage: 
        DebugviewConsole [-i <pattern>, --include <pattern>]... [-e <pattern>, --exclude <pattern>]... 
        DebugviewConsole (-h | --help)
        DebugviewConsole [-a value]
        DebugviewConsole [-x]
        DebugviewConsole [-u]
        DebugviewConsole [-cflsqtpn]

    Options:
        -h, --help                          show this screen
        -i <pattern>, --include <pattern>   include filter, may be specified multiple times
        -e <pattern>, --exclude <pattern>   exclude filter, may be specified multiple times
        -c              enable console output
        -d <file>       write to .dblog file

    Console options:    (no effect on .dblog file)
        -l              prefix line number

)";

Yes, by leaving it out of the Usage, it won't know how to apply it in the Options. It needs to be specified in both sections.