Skip to content

Commit

Permalink
style: pre-commit.ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 1, 2025
1 parent 70eeff6 commit 7d23386
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 9 additions & 14 deletions include/CLI/impl/Option_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,24 +664,19 @@ CLI11_INLINE int Option::_add_result(std::string &&result, std::vector<std::stri
int result_count = 0;
if((allow_extra_args_ || get_expected_max() > 1) && !result.empty() && result.front() == '[' &&
result.back() == ']') { // this is now a vector string likely from the default or user entry
if (result.size() >= 4 && result[1] == '[' && (*(result.end() - 2) == ']'))
{
//this is an escape clause for odd strings
std::string nstrs{ '[' };
bool duplicated{ true };
for (int ii = 2; ii < result.size() - 2; ii+=2)
{
if (result[ii] == result[ii + 1])
{
if(result.size() >= 4 && result[1] == '[' && (*(result.end() - 2) == ']')) {
// this is an escape clause for odd strings
std::string nstrs{'['};
bool duplicated{true};
for(int ii = 2; ii < result.size() - 2; ii += 2) {
if(result[ii] == result[ii + 1]) {
nstrs.push_back(result[ii]);

Check warning on line 673 in include/CLI/impl/Option_inl.hpp

View check run for this annotation

Codecov / codecov/patch

include/CLI/impl/Option_inl.hpp#L673

Added line #L673 was not covered by tests
}
else {
duplicated=false;
} else {
duplicated = false;
break;
}
}
if (duplicated)
{
if(duplicated) {
res.push_back(std::move(nstrs));
++result_count;
return result_count;

Check warning on line 682 in include/CLI/impl/Option_inl.hpp

View check run for this annotation

Codecov / codecov/patch

include/CLI/impl/Option_inl.hpp#L680-L682

Added lines #L680 - L682 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion tests/FuzzFailTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ TEST_CASE("app_roundtrip_custom") {
int index = GENERATE(range(1, 4));
std::string optionString, flagString;
auto parseData = loadFailureFile("round_trip_custom", index);
std::size_t pstring_start{0};
std::size_t pstring_start{0};
pstring_start = fuzzdata.add_custom_options(app.get(), parseData);

if(pstring_start > 0) {
Expand Down

0 comments on commit 7d23386

Please sign in to comment.