0
2
0
... | ... |
@@ -37,25 +37,25 @@ |
37 | 37 |
bool g1,g2,g3; |
38 | 38 |
ap.refOption("n", "An integer input.", i, true) |
39 | 39 |
.refOption("val", "A double input.", d) |
40 | 40 |
.doubleOption("val2", "A double input.", d) |
41 | 41 |
.synonym("vals","val") |
42 | 42 |
.refOption("name", "A string input.", s) |
43 | 43 |
.refOption("f", "A switch.", b) |
44 | 44 |
.refOption("nohelp", "", sil) |
45 | 45 |
.refOption("gra","Choice A",g1) |
46 | 46 |
.refOption("grb","Choice B",g2) |
47 | 47 |
.refOption("grc","Choice C",g3) |
48 | 48 |
.optionGroup("gr","gra") |
49 |
.optionGroup("gr"," |
|
49 |
.optionGroup("gr","grb") |
|
50 | 50 |
.optionGroup("gr","grc") |
51 | 51 |
.mandatoryGroup("gr") |
52 | 52 |
.onlyOneGroup("gr") |
53 | 53 |
.other("infile","The input file.") |
54 | 54 |
.other("..."); |
55 | 55 |
|
56 | 56 |
ap.parse(); |
57 | 57 |
|
58 | 58 |
std::cout << "Parameters of '" << ap.commandName() << "':\n"; |
59 | 59 |
|
60 | 60 |
if(ap.given("n")) std::cout << " Value of -n: " << i << std::endl; |
61 | 61 |
if(ap.given("val")) std::cout << " Value of -val: " << d << std::endl; |
... | ... |
@@ -185,25 +185,24 @@ |
185 | 185 |
p.help=help; |
186 | 186 |
p.type=FUNC; |
187 | 187 |
p.mandatory=false; |
188 | 188 |
_opts[name]=p; |
189 | 189 |
return *this; |
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
ArgParser &ArgParser::optionGroup(const std::string &group, |
193 | 193 |
const std::string &opt) |
194 | 194 |
{ |
195 | 195 |
Opts::iterator i = _opts.find(opt); |
196 | 196 |
LEMON_ASSERT(i!=_opts.end(), "Unknown option: '"+opt+"'"); |
197 |
if(i==_opts.end()) std::cout << "JAJJJJJJJJ\n"; |
|
198 | 197 |
LEMON_ASSERT(!(i->second.ingroup), |
199 | 198 |
"Option already in option group: '"+opt+"'"); |
200 | 199 |
GroupData &g=_groups[group]; |
201 | 200 |
g.opts.push_back(opt); |
202 | 201 |
i->second.ingroup=true; |
203 | 202 |
return *this; |
204 | 203 |
} |
205 | 204 |
|
206 | 205 |
ArgParser &ArgParser::onlyOneGroup(const std::string &group) |
207 | 206 |
{ |
208 | 207 |
GroupData &g=_groups[group]; |
209 | 208 |
g.only_one=true; |
0 comments (0 inline)