Added mechanism to understand passed Option without value.
[command.git] / src / main.cpp
1 #include <iostream>
2 #include <string>
3
4 #include "option.h"
5 #include "argument.h"
6 #include "command.h"
7
8 void argument_function(bool a) {
9     std::cout << "Argument: " << a << std::endl;
10 }
11
12 void option_function(std::string a) {
13     std::cout << "Help function " << a << std::endl;
14 }
15
16 void void_function(void) {
17     std::cout << "Void function " << std::endl;
18 }
19
20 int main(int argc, char *argv[]) {
21     command::Command command(argc, argv, {
22 //         new command::Argument<std::string>("File path", [](std::string value)->void { std::cout << "Hello from lambda " << value << std::endl; }),
23         new command::Argument<bool>("File path", argument_function),
24         new command::Option<std::string>("f", "Optional file", option_function),
25         new command::Option<void>("h", "Help", void_function)
26     });
27
28     return 0;
29 }