-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmd_args.cpp
More file actions
27 lines (21 loc) · 805 Bytes
/
cmd_args.cpp
File metadata and controls
27 lines (21 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "Options.hpp"
int main(int argc, char *argv[]){
auto arg_int = Options::AddIntOption("testNum", "A test parameter", 1);
auto arg_string = Options::AddStringOption("testString", "A test parameter", "Boh");
auto arg_bool = Options::AddBoolOption("testBool", "A flag", false);
auto arg_int_list = Options::AddIntListOption("testList", "An int list");
auto add_int_range = Options::AddIntRangeOption("testRange", "An int range");
if(!Options::parseArgs(argc,argv)){
Options::dumpOpts();
}
if(arg_int->setByUser){
cout<<"TestNum was set to: "<<arg_int->val <<endl;
}
if(arg_int_list->setByUser){
cout<<"testList was set to: ";
for(auto i: arg_int_list->val){
cout<<i<<" ";
}
cout<<endl;
}
}