docopt.cpp
docopt.cpp copied to clipboard
Long params don't except space instead of = for an empty opt arg
I believe that the docopt spec allows a long opt to be separated from its param by either an equals or a space. docopt c++ only accepts an equals. I've now realised that this is only for the edge case where the param is an empty string. This is possible using exec* system calls or indeed bash as follows:
myprog --opt ""
I'm not that familiar with the code but I question the if statement docopt.cpp:653
if (token.empty() || token=="--") {
std::string error = o->longOption() + " requires an argument";
throw Tokens::OptionError(std::move(error));
}
I'm not sure this is needed at all. val should just always be then next token regardless.