From 91cd2477dea4446ab9ee96750b1eee817af44390 Mon Sep 17 00:00:00 2001 From: Stephan van Veen Date: Thu, 9 May 2019 20:28:10 +0200 Subject: [PATCH] Fix broken indentation --- include/argparse.hpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index 5567a23..2b56ff5 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -69,7 +69,7 @@ bool upsert(std::map& aMap, KeyType const& aKey, ElementTy bool starts_with(const std::string& haystack, const std::string& needle) { return needle.length() <= haystack.length() && std::equal(needle.begin(), needle.end(), haystack.begin()); -}; +} // Get value at index from std::list template @@ -496,7 +496,7 @@ class ArgumentParser { if (tIterator != mArgumentMap.end()) { // Start parsing optional argument auto tArgument = tIterator->second; - tArgument->mUsedName = tCurrentArgument; + tArgument->mUsedName = tCurrentArgument; tArgument->mIsUsed = true; auto tCount = tArgument->mNumArgs; @@ -513,7 +513,7 @@ class ArgumentParser { while (tCount > 0) { i = i + 1; if (i < argc) { - tArgument->mUsedName = tCurrentArgument; + tArgument->mUsedName = tCurrentArgument; tArgument->mRawValues.emplace_back(argv[i]); if (tArgument->mAction != nullptr) tArgument->mValues.push_back(tArgument->mAction(argv[i])); @@ -542,24 +542,24 @@ class ArgumentParser { if (tIterator != mArgumentMap.end()) { auto tArgumentObject = tIterator->second; tNumArgs = tArgumentObject->mNumArgs; - std::vector tArgumentsForRecursiveParsing = { "", "-" + tArgument }; - while (tNumArgs > 0 && i < argc) { - i += 1; - if (i < argc) { - tArgumentsForRecursiveParsing.emplace_back(argv[i]); - tNumArgs -= 1; - } - } - parse_args_internal(tArgumentsForRecursiveParsing); + std::vector tArgumentsForRecursiveParsing = {"", "-" + tArgument}; + while (tNumArgs > 0 && i < argc) { + i += 1; + if (i < argc) { + tArgumentsForRecursiveParsing.emplace_back(argv[i]); + tNumArgs -= 1; + } + } + 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 { @@ -583,7 +583,7 @@ class ArgumentParser { break; } if (i < argc) { - tArgument->mUsedName = tCurrentArgument; + tArgument->mUsedName = tCurrentArgument; tArgument->mRawValues.emplace_back(argv[i]); if (tArgument->mAction != nullptr) tArgument->mValues.push_back(tArgument->mAction(argv[i]));