mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
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:
parent
535244d7b7
commit
bf12edd9a7
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user