initial commit

This commit is contained in:
ackimixs
2024-05-19 10:59:13 +02:00
commit 3131766c92
14 changed files with 563 additions and 0 deletions

26
example/main.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <Modelec/CLParser.h>
#include <iostream>
int main(int argc, char* argv[]) {
CLParser parser(argc, argv);
if (parser.hasOption("help")) {
std::cout << "Usage: " << parser.getPositionalArgument(0) << " [options]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " --help: Display this help message" << std::endl;
std::cout << " --port <port>: Set the port to listen to" << std::endl;
return 0;
}
std::optional<std::string> port = parser.getOption("port");
if (port.has_value()) {
std::cout << port.value() << std::endl;
} else {
std::cout << "No port specified" << std::endl;
}
return 0;
}