diff 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
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp	Wed Oct 26 15:42:52 2016 +0200
+++ b/Applications/Dicomizer.cpp	Wed Oct 26 16:53:54 2016 +0200
@@ -453,6 +453,7 @@
   boost::program_options::options_description generic("Generic options");
   generic.add_options()
     ("help", "Display this help and exit")
+    ("version", "Output version information and exit")
     ("verbose", "Be verbose in logs")
     ("threads", boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()), 
      "Number of processing threads to be used")
@@ -562,6 +563,7 @@
 
   if (!error &&
       options.count("help") == 0 &&
+      options.count("version") == 0 &&
       options.count("input") != 1)
   {
     LOG(ERROR) << "No input file was specified";
@@ -588,6 +590,12 @@
     return false;
   }
 
+  if (options.count("version")) 
+  { 
+    OrthancWSI::ApplicationToolbox::PrintVersion(argv[0]);
+    return false;
+  }
+
   if (options.count("verbose"))
   {
     Orthanc::Logging::EnableInfoLevel(true);