| 443 | } |
| 444 | |
| 445 | int main(int argc, char **argv) |
| 446 | { |
| 447 | |
| 448 | CLI::App app{"ConvertInputFormat"}; |
| 449 | argv = app.ensure_utf8(argv); |
| 450 | app.description("Run input file conversion tool"); |
| 451 | app.set_version_flag("-v,--version", EnergyPlus::DataStringGlobals::VerString); |
| 452 | |
| 453 | #ifdef _OPENMP |
| 454 | int number_of_threads = std::thread::hardware_concurrency(); |
| 455 | #else |
| 456 | int number_of_threads = 1; |
| 457 | #endif |
| 458 | |
| 459 | [[maybe_unused]] CLI::Option *nproc_opt = |
| 460 | app.add_option("-j", number_of_threads, fmt::format("Number of threads [Default: {}]", number_of_threads))->option_text("N"); |
| 461 | |
| 462 | #ifndef _OPENMP |
| 463 | // I don't want to throw if the user passes -j while OpenMP is unavailable, so we hide it by setting an empty group instead |
| 464 | nproc_opt->group(""); |
| 465 | #endif |
| 466 | |
| 467 | fs::path inputFilePath; |
| 468 | app.add_option("-i,--input", inputFilePath, "Text file with list of input files to convert (newline delimited)") |
| 469 | ->required(false) |
| 470 | ->option_text("LSTFILE") |
| 471 | ->check(CLI::ExistingFile); |
| 472 | |
| 473 | fs::path outputDirectoryPath; |
| 474 | app.add_option("-o,--output", outputDirectoryPath, "Output directory. Will use input file location by default") |
| 475 | ->option_text("DIR") |
| 476 | ->required(false); |
| 477 | // ->check(CLI::ExistingDirectory) // We don't require it to exist, we make it if needed |
| 478 | |
| 479 | const std::map<std::string, OutputTypes> outputTypeMap{ |
| 480 | {"default", OutputTypes::Default}, |
| 481 | {"idf", OutputTypes::IDF}, |
| 482 | {"epjson", OutputTypes::epJSON}, |
| 483 | {"cbor", OutputTypes::CBOR}, |
| 484 | {"msgpack", OutputTypes::MsgPack}, |
| 485 | {"ubjson", OutputTypes::UBJSON}, |
| 486 | {"bson", OutputTypes::BSON}, |
| 487 | }; |
| 488 | |
| 489 | OutputTypes outputType{OutputTypes::Default}; |
| 490 | |
| 491 | const std::string help_message = fmt::format(R"help(Output format. |
| 492 | Default means IDF->epJSON or epJSON->IDF |
| 493 | Select one (case insensitive): |
| 494 | [{}])help", |
| 495 | fmt::join(outputTypeStrs, ",")); |
| 496 | |
| 497 | app.add_option("-f,--format", outputType, help_message) |
| 498 | ->option_text("FORMAT") |
| 499 | ->required(false) |
| 500 | ->transform(CLI::CheckedTransformer(outputTypeMap, CLI::ignore_case)); |
| 501 | |
| 502 | bool noConvertHVACTemplate = false; |
nothing calls this directly
no test coverage detected