mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Merge pull request #90 from rysson/issue/89-print_req_if_no_def_val
Fix help if required and def-value. Fixes #89.
This commit is contained in:
commit
d0758e0ffa
@ -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