8 #include "multiValue.h"
12 using namespace command;
16 * @brief Simple example explaining how to bind class methods to command-line parameters
21 void _argument(bool a) {
22 std::cout << "Argument: " << a << std::endl;
24 void _option(std::string a) {
25 std::cout << "Help function " << a << std::endl;
28 std::cout << "Void function " << std::endl;
32 int main(int argc, char **argv)
37 Command command(argc, argv, {
38 // class method with bool parameter
39 new Argument<bool>("Input values", std::bind(&ExampleClass::_argument, &c, std::placeholders::_1)),
41 // class method std::string parameter
42 new Option<std::string>("f", "Optional file", std::bind(&ExampleClass::_option, &c, std::placeholders::_1)),
44 // class method without parameter
45 new Option<void>("h", "Help", std::bind(&ExampleClass::_void, &c))
48 /* Code is initialized.
50 * You can run your main program for example here
53 catch(const std::exception & e) {
54 std::cout << e.what() << std::endl;