bogus/src/ArgParser.cpp
2025-04-30 13:38:33 +10:00

39 lines
1.1 KiB
C++

#include "ArgParser.h"
bool debugMode = false;
ArgParser::ArgParser(int argc, char* argv[]) {
// First, collect all arguments
for (int i = 0; i < argc; i++) {
args.push_back(argv[i]);
}
// Then process them
for (int i = 0; i < args.size(); i++) {
if (args[i] == "--debug") {
debugMode = true;
args.erase(args.begin() + i);
} else if (args[i] == "--help") {
cout << "Boguslang interpreter" << endl;
cout << "Usage: bogus [file]" << endl;
cout << "Options:" << endl;
cout << " --debug Enable debug mode" << endl;
cout << " --help Show this help message" << endl;
cout << "Issues? Send an email to max@maxwellj.xyz" << endl;
cout << "Report bugs at https://git.maxwellj.xyz/max/bogus" << endl;
exit(0);
} else if (args[i] == "--version") {
cout << "Boguslang, version 0.0.3" << endl;
exit(0);
}
}
}
string ArgParser::getArg(int index) {
if (index >= 0 && index < args.size()) {
return args[index];
}
return "";
}