mirror of
https://github.com/modelec/cpp-lib.git
synced 2026-03-18 21:10:27 +01:00
parser example
This commit is contained in:
@@ -11,16 +11,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
int port = parser.getOption("port", 12);
|
int port = parser.getOption("port", 12);
|
||||||
|
|
||||||
std::cout << "Port : " << port << std::endl;
|
auto test = parser.getOption("host", "127.0.0.1");
|
||||||
|
|
||||||
auto test = parser.getOption<long>("long");
|
|
||||||
|
|
||||||
if (test.has_value()) {
|
|
||||||
std::cout << test.value() << std::endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
std::cout << "missing long argument" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user