bool isHelp = false; bool if1Cond = true; bool if2Cond = true; bool if3Cond = true; bool if4Cond = true; boost::program_options::options_description opts("if1 Options"); opts.add_options() ("help", "Print help message.") ("if1", boost::program_options::value(), "if1 condition") ("if2", boost::program_options::value(), "if2 condition") ("if3", boost::program_options::value(), "if3 condition") ("if4", boost::program_options::value(), "if4 condition") ("ifall", boost::program_options::value(), "all if conditions"); boost::program_options::variables_map vm; auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run(); boost::program_options::store(parsed, vm); boost::program_options::notify(vm); if (vm.count("help")) { std::cerr << opts << std::endl; isHelp = true; } else { if (vm.count("if1")) { if1Cond = vm["if1"].as(); } if (vm.count("if2")) { if2Cond = vm["if2"].as(); } if (vm.count("if3")) { if3Cond = vm["if3"].as(); } if (vm.count("if4")) { if4Cond = vm["if4"].as(); } if (vm.count("ifall")) { auto val = vm["ifall"].as(); if1Cond = val; if2Cond = val; if3Cond = val; if4Cond = val; } std::cerr << "if1 = " << if1Cond << std::endl; std::cerr << "if2 = " << if2Cond << std::endl; std::cerr << "if3 = " << if3Cond << std::endl; std::cerr << "if4 = " << if4Cond << std::endl; } wfInput.if1cond.setValue(if1Cond); wfInput.if2cond.setValue(if2Cond); wfInput.if3cond.setValue(if3Cond); wfInput.if4cond.setValue(if4Cond); wfInput.if1Value.setValue(-1); wfInput.if2Value.setValue(-1); wfInput.if3Value.setValue(-1); wfInput.if4Value.setValue(-1);