Handle the "--version" argument when iterating on argc

This commit is contained in:
Username404 2021-09-21 21:45:31 +02:00
parent 6ce13be4ca
commit 82520e63ba
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,6 @@ using namespace std;
#include "headers/transpiler/Target.hpp"
int main(int argc, char* argv[]) {
if ((argc == 2) && (((string) argv[1]) == "--version")) { cout << Yerbacon::getVersion() << endl; exit(EXIT_SUCCESS); }
string target = ".lua";
bool printResult = false;
bool parallel = false;
@ -21,7 +20,8 @@ int main(int argc, char* argv[]) {
for (signed int i = 0; i < argc; ++i)
{
const string_view currentArg (argv[i]);
if (currentArg == ArgumentShort("printresult")) printResult = true;
if ((argc == 2) && (currentArg == Argument("version"))) { cout << Yerbacon::getVersion() << endl; exit(EXIT_SUCCESS); }
else if (currentArg == ArgumentShort("printresult")) printResult = true;
else if (currentArg == ArgumentAssignable("target")) {
const string value = ArgumentAssignable::getValueFor(currentArg.data());
if (!value.empty()) (target = '.') += value;