bethyw.cpp
/*
  Run Beth Yw?, parsing the command line arguments, importing the data,
  and outputting the requested data to the standard output/error.

  Hint: cxxopts.parse() throws exceptions you'll need to catch. Read the cxxopts
  documentation for more information.

  @param argc
    Number of program arguments

  @param argv
    Program arguments

  @return
    Exit code
*/
Run Beth Yw?, parsing the command line arguments, importing the data,
and outputting the requested data to the standard output/error.

cxxopts.parse() throws exceptions you'll need to catch. Read the cxxopts
documentation for more information.
Run Beth Yw? parsing the command line arguments importing the data and outputting the requested data to the standard output / error . cxxopts . parse () throws exceptions you ' ll need to catch . Read the cxxopts documentation for more information .
int BethYw::run(int argc, char *argv[]) {
    auto cxxopts = BethYw::cxxoptsSetup();
  auto args = cxxopts.parse(argc, argv);
  if (args.count("help")) {
    std::cerr << cxxopts.help() << std::endl;
    return 0;
  }
  std::string dir = args["dir"].as<std::string>() + DIR_SEP;
   auto datasetsToImport = BethYw::parseDatasetsArg(args);
   auto areasFilter      = BethYw::parseAreasArg(args);
   auto measuresFilter   = BethYw::parseMeasuresArg(args);
   auto yearsFilter      = BethYw::parseYearsArg(args);
  Areas data = Areas();
  BethYw::loadAreas(data, dir, areasFilter);
  BethYw::loadDatasets(data,
                        dir,
                        datasetsToImport,
                        areasFilter,
                        measuresFilter,
                        yearsFilter);
  if (args.count("json")) {
    std::cout << data.toJSON() << std::endl;
  } else {
    std::cout << data << std::endl;
  }
  return 0;
}
int BethYw :: run ( int argc , char * argv [ ] ) { auto cxxopts = BethYw :: cxxoptsSetup ( ) ; auto args = cxxopts . parse ( argc , argv ) ; if ( args . count ( " " ) ) { std :: cerr << cxxopts . help ( ) << std :: endl ; return 0 ; } std :: string dir = args [ " " ] . as < std :: string > ( ) + DIR_SEP ; auto datasetsToImport = BethYw :: parseDatasetsArg ( args ) ; auto areasFilter = BethYw :: parseAreasArg ( args ) ; auto measuresFilter = BethYw :: parseMeasuresArg ( args ) ; auto yearsFilter = BethYw :: parseYearsArg ( args ) ; Areas data = Areas ( ) ; BethYw :: loadAreas ( data , dir , areasFilter ) ; BethYw :: loadDatasets ( data , dir , datasetsToImport , areasFilter , measuresFilter , yearsFilter ) ; if ( args . count ( " " ) ) { std :: cout << data . toJSON ( ) << std :: endl ; } else { std :: cout << data << std :: endl ; } return 0 ; }
Run Beth Yw?, parsing the command line arguments, importing the data,
and outputting the requested data to the standard output/error.
Run Beth Yw? parsing the command line arguments importing the data and outputting the requested data to the standard output / error .
// Print the help usage if requested // Parse data directory argument // Parse other arguments and import data // The output as JSON // The output as tables