main
| 41 | |
| 42 | // main |
| 43 | int main(int argc, char **argv) |
| 44 | { |
| 45 | REPORT_MEMORY_LEAKS; |
| 46 | |
| 47 | Utilities::logger.addSink(std::shared_ptr<Utilities::ConsoleSink>(new Utilities::ConsoleSink(Utilities::LogLevel::INFO))); |
| 48 | |
| 49 | LOG_INFO << "Git refspec: " << GIT_REFSPEC; |
| 50 | LOG_INFO << "Git SHA1: " << GIT_SHA1; |
| 51 | LOG_INFO << "Git status: " << GIT_LOCAL_STATUS; |
| 52 | |
| 53 | exePath = FileSystem::getProgramPath(); |
| 54 | |
| 55 | try |
| 56 | { |
| 57 | cxxopts::Options options(argv[0], "partio2vtk - Converts partio to vtk files"); |
| 58 | options |
| 59 | .positional_help("[single-file or sequence, e.g. particles_#.bgeo]") |
| 60 | .show_positional_help(); |
| 61 | |
| 62 | options.add_options() |
| 63 | ("h,help", "Print help") |
| 64 | ("s,startFrame", "Start frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1")) |
| 65 | ("e,endFrame", "End frame (only used if value is >= 0)", cxxopts::value<int>()->default_value("-1")) |
| 66 | ("o,outputDir", "Output directory", cxxopts::value<std::string>()) |
| 67 | ; |
| 68 | |
| 69 | options.add_options("invisible") |
| 70 | ("input-file", "Input file", cxxopts::value<std::string>()); |
| 71 | |
| 72 | options.parse_positional("input-file"); |
| 73 | auto result = options.parse(argc, argv); |
| 74 | |
| 75 | if (result.count("help")) |
| 76 | { |
| 77 | std::cout << options.help({ "" }) << std::endl; |
| 78 | exit(0); |
| 79 | } |
| 80 | |
| 81 | if (result.count("input-file")) |
| 82 | { |
| 83 | inputFile = result["input-file"].as<std::string>();; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | std::cout << options.help({ "" }) << std::endl; |
| 88 | exit(0); |
| 89 | } |
| 90 | |
| 91 | if (result.count("outputDir")) |
| 92 | outDir = result["outputDir"].as<std::string>(); |
| 93 | LOG_INFO << "Output directory: " << outDir; |
| 94 | |
| 95 | if (result.count("startFrame")) |
| 96 | startFrame = result["startFrame"].as<int>(); |
| 97 | LOG_INFO << "Start frame: " << startFrame; |
| 98 | |
| 99 | if (result.count("endFrame")) |
| 100 | endFrame = result["endFrame"].as<int>(); |
nothing calls this directly
no test coverage detected