| 13 | using namespace chi; |
| 14 | |
| 15 | int get(const std::vector<std::string>& opts) { |
| 16 | po::options_description get_options("get options"); |
| 17 | get_options.add_options()("module", po::value<std::vector<std::string>>(), "Modules to get")( |
| 18 | "workspace,w", po::value<std::string>()->default_value(fs::current_path().string()), |
| 19 | "The workspace path. Leave blank to inferr from the working directory"); |
| 20 | |
| 21 | po::positional_options_description pos; |
| 22 | pos.add("module", -1); |
| 23 | |
| 24 | po::variables_map vm; |
| 25 | po::store(po::command_line_parser(opts).options(get_options).positional(pos).run(), vm); |
| 26 | |
| 27 | if (vm.count("module") == 0) { |
| 28 | std::cerr << "no input files" << std::endl; |
| 29 | return 1; |
| 30 | } |
| 31 | auto modules = vm["module"].as<std::vector<std::string>>(); |
| 32 | |
| 33 | Context ctx{vm["workspace"].as<std::string>()}; |
| 34 | Result res; |
| 35 | |
| 36 | for (const auto& mod : modules) { res += ctx.fetchModule(mod, true); } |
| 37 | |
| 38 | std::cout << res << std::endl; |
| 39 | if (!res) { return 1; } |
| 40 | return 0; |
| 41 | } |
no test coverage detected