mirror of
https://github.com/modelec/cpp-lib.git
synced 2026-01-19 00:27:22 +01:00
26 lines
709 B
C++
26 lines
709 B
C++
#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;
|
|
} |