-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
37 lines (27 loc) · 1.1 KB
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "argparser.h"
int main(int argc, char** argv) {
Arguments::String first('f', "none");
first.alias("first");
Arguments::Int second("second", 0);
second.alias('s');
Arguments::Bool third("third");
third.alias("abc").alias('t');
Arguments::PositionalString name("", true);
Arguments::PositionalInt age(0, false);
if (Arguments::parse(argc, argv) != Arguments::NO_ERROR) {
return 0;
}
std::cout << "Found:" << std::endl;
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;
return 0;
}