1 |
|
|
|
2 |
|
|
/*************************************** |
3 |
|
|
Auteur : Pierre Aubert |
4 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
5 |
|
|
Licence : CeCILL-C |
6 |
|
|
****************************************/ |
7 |
|
|
|
8 |
|
|
#include "phoenix_check.h" |
9 |
|
|
#include "OptionParser.h" |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
///Create the OptionParser of this program |
13 |
|
|
/** @return OptionParser of this program |
14 |
|
|
*/ |
15 |
|
1 |
OptionParser createOptionParser(){ |
16 |
✓✓ |
2 |
OptionParser parser(true, "1.0.0"); |
17 |
✓✓✓✓
|
1 |
parser.addOption("plugin", "p", OptionType::FILENAME, true, "Required option"); |
18 |
|
|
|
19 |
✓ |
2 |
std::string defaultConfigHost(""); |
20 |
✓✓✓✓ ✓ |
1 |
parser.addOption("config", "c", defaultConfigHost, "Optional value"); |
21 |
|
|
|
22 |
✓✓✓✓
|
1 |
parser.addOption("loadonly", "l", OptionType::NONE, false, "Optional Trigger option"); |
23 |
|
2 |
return parser; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
1 |
int main(int argc, char** argv){ |
27 |
✓ |
2 |
OptionParser parser = createOptionParser(); |
28 |
✓ |
1 |
parser.parseArgument(argc, argv); |
29 |
|
|
|
30 |
✓ |
1 |
const OptionMode & defaultMode = parser.getDefaultMode(); |
31 |
✓ |
1 |
std::string pluginOption(""); |
32 |
✓✓ |
1 |
defaultMode.getValue(pluginOption, "plugin"); |
33 |
✓✓✓✓
|
1 |
std::cout << "pluginOption = '" << pluginOption << "'" << std::endl; |
34 |
|
|
|
35 |
|
1 |
bool b(true); |
36 |
✓✓✓ |
1 |
b &= phoenix_check("Check ", pluginOption, "RequiredOptionValue"); |
37 |
✓✓ |
1 |
phoenix_functionOk("final", b); |
38 |
|
1 |
return b - 1; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
|