28 const po::variables_map& ,
29 const std::vector<std::string>& ) {
30 printf(
"running %s\n", cmd.c_str());
34 const po::variables_map& options,
35 const std::vector<std::string>& args) {
36 printf(
"foo global-foo %d\n", options[
"global-foo"].as<int32_t>());
37 printf(
"foo local-foo %d\n", options[
"local-foo"].as<int32_t>());
38 for (
auto& arg : args) {
39 printf(
"foo arg %s\n", arg.c_str());
49 app.
addCommand(
"foo",
"[args...]",
"Do some foo",
"Does foo",
foo)
51 (
"local-foo", po::value<int32_t>()->default_value(42),
"Local foo");
55 return app.
run(argc, argv);
void addAlias(std::string newName, std::string oldName)
int main(int argc, char *argv[])
boost::program_options::options_description & addCommand(std::string name, std::string argStr, std::string shortHelp, std::string fullHelp, Command command)
DEFINE_int32(global_foo, 42,"Global foo")
void addGFlags(ProgramOptionsStyle style=ProgramOptionsStyle::GNU)
int run(int argc, const char *const argv[])