-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExample3.cpp
More file actions
52 lines (40 loc) · 2.24 KB
/
Copy pathExample3.cpp
File metadata and controls
52 lines (40 loc) · 2.24 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "Arguments.h"
using namespace Moya::System::Arguments;
int main(int argc, const char **argv)
{
Syntax syntax("Loro device programmer", "2.1.32.7");
syntax.add(Command("list", "list", "Lists all Loro devices.",
"Command lists system names of all connected Loro devices."));
syntax.add(Command("reset", "reset", "Resets device.",
"Command resets Loro device."));
syntax.add(Parameter("device-name", "-d", "Name of a device.", false, true));
syntax.add(Command("program", "program", "Programs device with specified file.",
"Command programs Loro device with specified program file."));
syntax.add(Parameter("device-name", "-d", "Name of a device.", false, true));
syntax.add(Parameter("program-file-path", "-p", "Program file path.", true, true));
syntax.add(Command("backup", "backup", "Downloads device program into local file for backup.",
"Command reads Loro device program and stores it in local file."));
syntax.add(Parameter("device-name", "-d", "Name of a device.", false, true));
syntax.add(Parameter("program-file-path", "-p", "Program file path.", true, true));
syntax.add(Command("erase", "erase", "Erases device.",
"Command erases program from Loro device."));
syntax.add(Parameter("device-name", "-d", "Name of a device.", false, true));
syntax.add(Command("secure", "secure", "Secures device.",
"Command secures Loro device. Once the device is secured its "
"program cannot be read or updated even by external programmer. "
"To exit secured mode the device need to be reset to factory "
"settings using special electrical technique."));
syntax.add(Parameter("device-name", "-d", "Name of a device.", false, true));
syntax.add(Parameter("force", "-f", "Do not prompt.", false, false));
Arguments arguments(argc, argv);
Parser parser(syntax, arguments);
if (!parser.parse()) {
Help help(syntax, parser, arguments);
return help.run();
}
std::cout << "Application started normally." << std::endl;
std::cout << "Following arguments were parsed:" << std::endl;
for (auto item : parser)
std::cout << " '" << item.first << "' = '" << item.second << "'" << std::endl;
return 0;
}