mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Fix broken indentation
This commit is contained in:
parent
2dc9121acf
commit
91cd2477de
@ -69,7 +69,7 @@ bool upsert(std::map<KeyType, ElementType>& aMap, KeyType const& aKey, ElementTy
|
|||||||
bool starts_with(const std::string& haystack, const std::string& needle) {
|
bool starts_with(const std::string& haystack, const std::string& needle) {
|
||||||
return needle.length() <= haystack.length()
|
return needle.length() <= haystack.length()
|
||||||
&& std::equal(needle.begin(), needle.end(), haystack.begin());
|
&& std::equal(needle.begin(), needle.end(), haystack.begin());
|
||||||
};
|
}
|
||||||
|
|
||||||
// Get value at index from std::list
|
// Get value at index from std::list
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -496,7 +496,7 @@ class ArgumentParser {
|
|||||||
if (tIterator != mArgumentMap.end()) {
|
if (tIterator != mArgumentMap.end()) {
|
||||||
// Start parsing optional argument
|
// Start parsing optional argument
|
||||||
auto tArgument = tIterator->second;
|
auto tArgument = tIterator->second;
|
||||||
tArgument->mUsedName = tCurrentArgument;
|
tArgument->mUsedName = tCurrentArgument;
|
||||||
tArgument->mIsUsed = true;
|
tArgument->mIsUsed = true;
|
||||||
auto tCount = tArgument->mNumArgs;
|
auto tCount = tArgument->mNumArgs;
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ class ArgumentParser {
|
|||||||
while (tCount > 0) {
|
while (tCount > 0) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
tArgument->mUsedName = tCurrentArgument;
|
tArgument->mUsedName = tCurrentArgument;
|
||||||
tArgument->mRawValues.emplace_back(argv[i]);
|
tArgument->mRawValues.emplace_back(argv[i]);
|
||||||
if (tArgument->mAction != nullptr)
|
if (tArgument->mAction != nullptr)
|
||||||
tArgument->mValues.push_back(tArgument->mAction(argv[i]));
|
tArgument->mValues.push_back(tArgument->mAction(argv[i]));
|
||||||
@ -542,24 +542,24 @@ class ArgumentParser {
|
|||||||
if (tIterator != mArgumentMap.end()) {
|
if (tIterator != mArgumentMap.end()) {
|
||||||
auto tArgumentObject = tIterator->second;
|
auto tArgumentObject = tIterator->second;
|
||||||
tNumArgs = tArgumentObject->mNumArgs;
|
tNumArgs = tArgumentObject->mNumArgs;
|
||||||
std::vector<std::string> tArgumentsForRecursiveParsing = { "", "-" + tArgument };
|
std::vector<std::string> tArgumentsForRecursiveParsing = {"", "-" + tArgument};
|
||||||
while (tNumArgs > 0 && i < argc) {
|
while (tNumArgs > 0 && i < argc) {
|
||||||
i += 1;
|
i += 1;
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
tArgumentsForRecursiveParsing.emplace_back(argv[i]);
|
tArgumentsForRecursiveParsing.emplace_back(argv[i]);
|
||||||
tNumArgs -= 1;
|
tNumArgs -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parse_args_internal(tArgumentsForRecursiveParsing);
|
parse_args_internal(tArgumentsForRecursiveParsing);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!tArgument.empty() && tArgument[0] == '-')
|
||||||
|
std::cout << "warning: unrecognized optional argument " << tArgument
|
||||||
|
<< std::endl;
|
||||||
|
else
|
||||||
|
std::cout << "warning: unrecognized optional argument -" << tArgument
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (!tArgument.empty() && tArgument[0] == '-')
|
|
||||||
std::cout << "warning: unrecognized optional argument " << tArgument
|
|
||||||
<< std::endl;
|
|
||||||
else
|
|
||||||
std::cout << "warning: unrecognized optional argument -" << tArgument
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -583,7 +583,7 @@ class ArgumentParser {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
tArgument->mUsedName = tCurrentArgument;
|
tArgument->mUsedName = tCurrentArgument;
|
||||||
tArgument->mRawValues.emplace_back(argv[i]);
|
tArgument->mRawValues.emplace_back(argv[i]);
|
||||||
if (tArgument->mAction != nullptr)
|
if (tArgument->mAction != nullptr)
|
||||||
tArgument->mValues.push_back(tArgument->mAction(argv[i]));
|
tArgument->mValues.push_back(tArgument->mAction(argv[i]));
|
||||||
|
Loading…
Reference in New Issue
Block a user