comparison Applications/Dicomizer.cpp @ 8:62adabb8c122

Provide "--version" in command-line tools
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Oct 2016 16:53:54 +0200
parents 4a7a53257c7d
children 952b2c6ee0a2
comparison
equal deleted inserted replaced
7:bc3ca410b765 8:62adabb8c122
451 { 451 {
452 // Declare the supported parameters 452 // Declare the supported parameters
453 boost::program_options::options_description generic("Generic options"); 453 boost::program_options::options_description generic("Generic options");
454 generic.add_options() 454 generic.add_options()
455 ("help", "Display this help and exit") 455 ("help", "Display this help and exit")
456 ("version", "Output version information and exit")
456 ("verbose", "Be verbose in logs") 457 ("verbose", "Be verbose in logs")
457 ("threads", boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()), 458 ("threads", boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()),
458 "Number of processing threads to be used") 459 "Number of processing threads to be used")
459 ("openslide", boost::program_options::value<std::string>(), 460 ("openslide", boost::program_options::value<std::string>(),
460 "Path to the shared library of OpenSlide (not necessary if converting from standard hierarchical TIFF)") 461 "Path to the shared library of OpenSlide (not necessary if converting from standard hierarchical TIFF)")
560 return false; 561 return false;
561 } 562 }
562 563
563 if (!error && 564 if (!error &&
564 options.count("help") == 0 && 565 options.count("help") == 0 &&
566 options.count("version") == 0 &&
565 options.count("input") != 1) 567 options.count("input") != 1)
566 { 568 {
567 LOG(ERROR) << "No input file was specified"; 569 LOG(ERROR) << "No input file was specified";
568 error = true; 570 error = true;
569 } 571 }
583 if (error) 585 if (error)
584 { 586 {
585 exitStatus = -1; 587 exitStatus = -1;
586 } 588 }
587 589
590 return false;
591 }
592
593 if (options.count("version"))
594 {
595 OrthancWSI::ApplicationToolbox::PrintVersion(argv[0]);
588 return false; 596 return false;
589 } 597 }
590 598
591 if (options.count("verbose")) 599 if (options.count("verbose"))
592 { 600 {