2022-07-26 02:57:57 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
#include "argparser.h"
|
2022-07-26 02:57:57 +00:00
|
|
|
|
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
int main(int argc, char** argv) {
|
|
|
|
Arguments::String first('f', "none");
|
2024-07-14 00:56:16 +00:00
|
|
|
first.alias("first");
|
2022-07-26 02:57:57 +00:00
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
Arguments::Int second("second", 0);
|
2024-07-14 00:56:16 +00:00
|
|
|
second.alias('s');
|
2022-07-26 02:57:57 +00:00
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
Arguments::Bool third("third");
|
2024-07-14 00:56:16 +00:00
|
|
|
third.alias("abc").alias('t');
|
2022-07-26 02:57:57 +00:00
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
Arguments::PositionalString name("", true);
|
|
|
|
Arguments::PositionalInt age(0, false);
|
2022-07-26 02:57:57 +00:00
|
|
|
|
2024-07-08 20:21:09 +00:00
|
|
|
if (Arguments::parse(argc, argv) != Arguments::NO_ERROR) {
|
2022-07-27 03:26:02 +00:00
|
|
|
return 0;
|
2022-07-26 02:57:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "Found:" << std::endl;
|
2024-07-08 20:21:09 +00:00
|
|
|
std::cout << "\tFirst: " << first.found << std::endl;
|
|
|
|
std::cout << "\tSecond: " << second.found << std::endl;
|
|
|
|
std::cout << "\tThird: " << third.found << std::endl;
|
|
|
|
std::cout << "\tName: " << name.found << std::endl;
|
|
|
|
std::cout << "\tAge: " << age.found << std::endl;
|
|
|
|
|
|
|
|
std::cout << std::endl << "Values:" << std::endl;
|
|
|
|
std::cout << "\tFirst: " << first.value << std::endl;
|
|
|
|
std::cout << "\tSecond: " << second.value << std::endl;
|
|
|
|
std::cout << "\tName: " << name.value << std::endl;
|
|
|
|
std::cout << "\tAge: " << age.value << std::endl;
|
2022-07-26 02:57:57 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|