Added mechanism to understand passed Option without value.
[command.git] / src / main.cpp
index 37ca36f9d6cabd4ceb67bf239b8a6a9f3c0149d8..5a42e860c14eaad667c3ca656e93be3b23ca85e1 100644 (file)
@@ -1,10 +1,28 @@
+#include <iostream>
+#include <string>
 
-int main() {
+#include "option.h"
+#include "argument.h"
+#include "command.h"
+
+void argument_function(bool a) {
+    std::cout << "Argument: " << a << std::endl;
+}
+
+void option_function(std::string a) {
+    std::cout << "Help function " << a << std::endl;
+}
+
+void void_function(void) {
+    std::cout << "Void function " << std::endl;
+}
+
+int main(int argc, char *argv[]) {
     command::Command command(argc, argv, {
-        command::Option<std::string>("f", "File path", [](std::string value)->void { cout << "Sth: " << value << endl; }),
-        command::Argument<std::string>("File path", []()->void { cout << "Sth: " << value << endl; }),
-        command::Option<void>("help", "Help description", [](void)->void { cout << "Sth: " << value << endl; }),
-        command::Option<void>("verbose", "Verbose option description", &myClass->verbose)
+//         new command::Argument<std::string>("File path", [](std::string value)->void { std::cout << "Hello from lambda " << value << std::endl; }),
+        new command::Argument<bool>("File path", argument_function),
+        new command::Option<std::string>("f", "Optional file", option_function),
+        new command::Option<void>("h", "Help", void_function)
     });
 
     return 0;