Fix help if required and def-value. Fixes #89.

Propose, skip text "[Required]" if argument has default value,
because the argument can be omitted in commend-line.
This commit is contained in:
Robert Kalinowski 2020-11-30 19:53:06 +01:00
parent 535244d7b7
commit bf12edd9a7

View File

@ -483,7 +483,7 @@ public:
std::copy(std::begin(argument.mNames), std::end(argument.mNames), std::copy(std::begin(argument.mNames), std::end(argument.mNames),
std::ostream_iterator<std::string>(nameStream, " ")); std::ostream_iterator<std::string>(nameStream, " "));
stream << nameStream.str() << "\t" << argument.mHelp; stream << nameStream.str() << "\t" << argument.mHelp;
if (argument.mIsRequired) if (argument.mIsRequired && !argument.mDefaultValue.has_value())
stream << "[Required]"; stream << "[Required]";
stream << "\n"; stream << "\n";
return stream; return stream;