docopt / docopt.cpp

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

Argument names with characters other than letters (like underscores or numbers) don't work #147

Open ericonr opened 2 years ago

ericonr commented 2 years ago
#include "docopt.h"

static const char usage[] =
R"(Usage:
    underscore -a BASE_ADDRESS
)";

int main(int argc, char *argv[])
{
    auto args = docopt::docopt(usage, {argv+1, argv+argc}, true);
}

This prints:

$ ./underscore -a 1
Arguments did not match expected patterns
Usage:
    underscore -a BASE_ADDRESS

If BASE_ADDRESS becomes BASE1ADDRESS or BASE-ADDRESS, the error still happens.

This should be either documented or fixed, I think.

jaredgrubb commented 2 years ago

I think this would be a good enhancement.