From 6945900140b05a45058d77d7da523f617557d8ba Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 9 Apr 2022 22:53:45 +0200 Subject: [PATCH] main.cpp: Rename "currentArg" to "currentArgument" Signed-off-by: Username404 --- src/main.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fb74d80..7423ac6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,55 +21,55 @@ int main(int argc, char* argv[]) { map Units; for (signed int i = 1; i < argc; ++i) { - const string_view currentArg (argv[i]); - if (currentArg == ArgumentShort("printresult")) printResult = true; - else if (currentArg == ArgumentAssignable("target")) { - const string_view value = ArgumentAssignable::getValueFor(currentArg); + const string_view currentArgument (argv[i]); + if (currentArgument == ArgumentShort("printresult")) printResult = true; + else if (currentArgument == ArgumentAssignable("target")) { + const string_view value = ArgumentAssignable::getValueFor(currentArgument); if (not value.empty()) target = value; else Yerbacon::fail("No target was provided."); } - else if (currentArg == Argument("parallel")) parallel = true; - else if (currentArg == ArgumentAssignable("newlines")) { - const string_view enabled = ArgumentAssignable::getValueFor(currentArg); + else if (currentArgument == Argument("parallel")) parallel = true; + else if (currentArgument == ArgumentAssignable("newlines")) { + const string_view enabled = ArgumentAssignable::getValueFor(currentArgument); if (enabled == "off") { newLines = false; } else if (enabled == "on") { newLines = true; } else goto invalid_argument; } - else if (currentArg == ArgumentShort("text")) { text_provided = true; printResult = true; } - else if ((currentArg.ends_with(".ybcon") && !text_provided) || text_provided) - Units.insert_or_assign(currentArg, async(not parallel ? launch::deferred : launch::async, [currentArg, &text_provided, &target, &newLines]() { + else if (currentArgument == ArgumentShort("text")) { text_provided = true; printResult = true; } + else if ((currentArgument.ends_with(".ybcon") && !text_provided) || text_provided) + Units.insert_or_assign(currentArgument, async(not parallel ? launch::deferred : launch::async, [currentArgument, &text_provided, &target, &newLines]() { unit_result resultingPair; try { resultingPair.first = Target::forName(target, newLines)->transpileWithTree( - parseString(text_provided ? currentArg : getFileContent(currentArg.data())) + parseString(text_provided ? currentArgument : getFileContent(currentArgument.data())) ); - if (not text_provided) outputFileContent(string(currentArg.substr(0, currentArg.size() - 6)) + '.' + target, resultingPair.first); + if (not text_provided) outputFileContent(string(currentArgument.substr(0, currentArgument.size() - 6)) + '.' + target, resultingPair.first); } catch (const Yerbacon::Exception& error) { size_t lastSlash = 0; - const size_t position1 = currentArg.find_last_of('/'); + const size_t position1 = currentArgument.find_last_of('/'); if (cmp_not_equal(position1, string_view::npos)) lastSlash = position1; if constexpr(filesystem::path::preferred_separator != '/') { - const size_t position2 = currentArg.find_last_of(filesystem::path::preferred_separator); + const size_t position2 = currentArgument.find_last_of(filesystem::path::preferred_separator); if (cmp_not_equal(position2, string_view::npos)) { lastSlash = max(lastSlash, position2); } } - resultingPair.first = currentArg.substr(lastSlash + 1); + resultingPair.first = currentArgument.substr(lastSlash + 1); resultingPair.second.emplace(error); } return resultingPair; })); else { if (argc == 2) { - if (currentArg == Argument("version")) { + if (currentArgument == Argument("version")) { cout << Yerbacon::getVersion(); - } else if (currentArg == Argument("buildInfo")) { + } else if (currentArgument == Argument("buildInfo")) { cout << Yerbacon::getBuildInfo(); } else goto invalid_argument; cout << '\n'; exit(EXIT_SUCCESS); - } else invalid_argument: Yerbacon::fail({"\"", currentArg.data(), "\" is not a valid argument."}); + } else invalid_argument: Yerbacon::fail({"\"", currentArgument.data(), "\" is not a valid argument."}); } } if (!Units.empty()) {