mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54: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::ostream_iterator<std::string>(nameStream, " "));
|
||||
stream << nameStream.str() << "\t" << argument.mHelp;
|
||||
if (argument.mIsRequired)
|
||||
if (argument.mIsRequired && !argument.mDefaultValue.has_value())
|
||||
stream << "[Required]";
|
||||
stream << "\n";
|
||||
return stream;
|
||||
|
Loading…
Reference in New Issue
Block a user