mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Removed brackets and quotes in error message
This commit is contained in:
parent
4111905a74
commit
78ba5e9828
@ -827,9 +827,6 @@ public:
|
||||
std::string get_usage_full() const {
|
||||
std::stringstream usage;
|
||||
|
||||
if (!m_is_required) {
|
||||
usage << "[";
|
||||
}
|
||||
usage << get_names_csv();
|
||||
const std::string metavar = !m_metavar.empty() ? m_metavar : "VAR";
|
||||
if (m_num_args_range.get_max() > 0) {
|
||||
@ -838,9 +835,6 @@ public:
|
||||
usage << "...";
|
||||
}
|
||||
}
|
||||
if (!m_is_required) {
|
||||
usage << "]";
|
||||
}
|
||||
return usage.str();
|
||||
}
|
||||
|
||||
@ -1833,8 +1827,8 @@ private:
|
||||
if (not_help_or_version) {
|
||||
if (!opt.m_is_used) {
|
||||
throw std::runtime_error(
|
||||
"Zero positional arguments expected, did you mean '" +
|
||||
opt.get_usage_full() + "'");
|
||||
"Zero positional arguments expected, did you mean " +
|
||||
opt.get_usage_full());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,14 @@ TEST_CASE("Missing optional argument name" * test_suite("error_reporting")) {
|
||||
SUBCASE("Bad case") {
|
||||
REQUIRE_THROWS_WITH_AS(
|
||||
parser.parse_args({"test", "-a", "1", "2"}),
|
||||
"Zero positional arguments expected, did you mean '[-b VAR]'",
|
||||
"Zero positional arguments expected, did you mean -b VAR",
|
||||
std::runtime_error);
|
||||
}
|
||||
|
||||
SUBCASE("Bad case 2") {
|
||||
REQUIRE_THROWS_WITH_AS(
|
||||
parser.parse_args({"test", "1", "2"}),
|
||||
"Zero positional arguments expected, did you mean '[-a VAR]'",
|
||||
"Zero positional arguments expected, did you mean -a VAR",
|
||||
std::runtime_error);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user