06fbf1e14bd7befddfa64ccff38b62e5402edc19
[command.git] / src / main.cpp
1 #include <iostream>
2 #include <string>
3
4 #include "option.h"
5 #include "argument.h"
6 #include "required.h"
7 #include "multiValue.h"
8 #include "command.h"
9
10 using namespace command;
11
12 void argument_function(bool a) {
13     std::cout << "Argument: " << a << std::endl;
14 }
15
16 void option_function(std::string a) {
17     std::cout << "Help function " << a << std::endl;
18 }
19
20 void void_function(void) {
21     std::cout << "Void function " << std::endl;
22 }
23
24 int main(int argc, char *argv[]) {
25     try {
26         Command command(argc, argv, {
27 //             new Argument<std::string>("File path", [](std::string value)->void { std::cout << "Hello from lambda " << value << std::endl; }),
28             new Required(new MultiValue("-", new Argument<bool>("Input values", argument_function))),
29             new MultiValue(",", new Option<std::string>("f", "Optional file", option_function)),
30             new Option<void>("h", "Help", void_function)
31         });
32
33     }
34     catch(const std::exception & e) {
35         std::cout << e.what() << std::endl;
36     }
37
38     return 0;
39 }