mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 14:44:40 +00:00
Include canonical argument name in nargs range validation error
The name of a positional argument is never used. Closes #208 Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
parent
997da92556
commit
2a15178bb7
@ -758,6 +758,8 @@ private:
|
||||
std::stringstream stream;
|
||||
if (!m_used_name.empty()) {
|
||||
stream << m_used_name << ": ";
|
||||
} else {
|
||||
stream << m_names.front() << ": ";
|
||||
}
|
||||
if (m_num_args_range.is_exact()) {
|
||||
stream << m_num_args_range.get_min();
|
||||
|
@ -18,7 +18,7 @@ TEST_CASE("Missing expected positional argument" *
|
||||
argparse::ArgumentParser program("test");
|
||||
program.add_argument("input");
|
||||
REQUIRE_THROWS_WITH_AS(program.parse_args({"test"}),
|
||||
"1 argument(s) expected. 0 provided.",
|
||||
"input: 1 argument(s) expected. 0 provided.",
|
||||
std::runtime_error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user