comparison Applications/DicomToTiff.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 8e1dfd531335
comparison
equal deleted inserted replaced
7:bc3ca410b765 8:62adabb8c122
38 { 38 {
39 // Declare the supported parameters 39 // Declare the supported parameters
40 boost::program_options::options_description generic("Generic options"); 40 boost::program_options::options_description generic("Generic options");
41 generic.add_options() 41 generic.add_options()
42 ("help", "Display this help and exit") 42 ("help", "Display this help and exit")
43 ("version", "Output version information and exit")
43 ("verbose", "Be verbose in logs") 44 ("verbose", "Be verbose in logs")
44 ; 45 ;
45 46
46 boost::program_options::options_description source("Options for the source DICOM image"); 47 boost::program_options::options_description source("Options for the source DICOM image");
47 source.add_options() 48 source.add_options()
88 LOG(ERROR) << "Error while parsing the command-line arguments: " << e.what(); 89 LOG(ERROR) << "Error while parsing the command-line arguments: " << e.what();
89 error = true; 90 error = true;
90 } 91 }
91 92
92 if (!error && 93 if (!error &&
93 options.count("help") == 0) 94 options.count("help") == 0 &&
95 options.count("version") == 0)
94 { 96 {
95 if (options.count("input") != 1) 97 if (options.count("input") != 1)
96 { 98 {
97 LOG(ERROR) << "No input series was specified"; 99 LOG(ERROR) << "No input series was specified";
98 error = true; 100 error = true;
120 if (error) 122 if (error)
121 { 123 {
122 exitStatus = -1; 124 exitStatus = -1;
123 } 125 }
124 126
127 return false;
128 }
129
130 if (options.count("version"))
131 {
132 OrthancWSI::ApplicationToolbox::PrintVersion(argv[0]);
125 return false; 133 return false;
126 } 134 }
127 135
128 if (options.count("verbose")) 136 if (options.count("verbose"))
129 { 137 {