- Command command(argc, argv, {
-// new Argument<std::string>("File path", [](std::string value)->void { std::cout << "Hello from lambda " << value << std::endl; }),
- new Required(new Argument<bool>("File path", argument_function)),
- new Option<std::string>("f", "Optional file", option_function),
- new Option<void>("h", "Help", void_function)
- });
+ ExampleClass c;
+
+ try {
+ Command command(argc, argv, {
+ new Grouped({
+ new Required(
+ new MultiValue("-",
+ new Argument<bool>("Input values", std::bind(&ExampleClass::_argument, &c, std::placeholders::_1))
+ )
+ ),
+ new MultiValue(",",
+ new Option<std::string>("f", "Optional file", std::bind(&ExampleClass::_option, &c, std::placeholders::_1))
+ )
+ }),
+ new Option<void>("h", "Help", std::bind(&ExampleClass::_void, &c)),
+
+ // just a pure method calling
+ new Option<void>("v", "version", void_function)
+ });
+
+ /* ExampleClass is initialized.
+ * You can run your main program now
+ */
+ }
+ catch(const std::exception & e) {
+ std::cout << e.what() << std::endl;
+ }