Add Grouped behaviour.
[command.git] / src / main.cpp
index 379d14a6e3004c3b1f4a16436994b2f98f01f881..5ad96a22520a2e9f5c1547e8e184d2f3f3a3e674 100644 (file)
@@ -1,4 +1,40 @@
+#include <iostream>
+#include <string>
+
+#include "option.h"
+#include "argument.h"
+#include "required.h"
+#include "multiValue.h"
+#include "grouped.h"
+#include "command.h"
+
+using namespace command;
+
+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[]) {
+    try {
+        Command command(argc, argv, {
+            new Grouped({
+                new Required(new MultiValue("-", new Argument<bool>("Input values", argument_function))),
+                new MultiValue(",", new Option<std::string>("f", "Optional file", option_function))
+            }),
+            new Option<void>("h", "Help", void_function)
+        });
+    }
+    catch(const std::exception & e) {
+        std::cout << e.what() << std::endl;
+    }
 
-int main() {
     return 0;
 }
\ No newline at end of file