diff runner/JAMSFeatureWriter.cpp @ 197:3b7ec45abd1c

Add mandatory option --json-format to JSON feature writer, in preparation for supporting multiple JSON formats (perhaps) in future
author Chris Cannam
date Tue, 01 Sep 2015 17:05:32 +0100
parents bb295c0feb3e
children f35bbb3e4d41
line wrap: on
line diff
--- a/runner/JAMSFeatureWriter.cpp	Tue Sep 01 15:51:07 2015 +0100
+++ b/runner/JAMSFeatureWriter.cpp	Tue Sep 01 17:05:32 2015 +0100
@@ -57,10 +57,16 @@
     Parameter p;
 
     p.name = "network";
-    p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally";
+    p.description = "Attempt to retrieve RDF descriptions of plugins from network, if not available locally.";
     p.hasArg = false;
     pl.push_back(p);
 
+    p.name = "format";
+    p.description = "JSON format to use. Currently the only supported value is \"jams\". Other formats may be supported in future.";
+    p.hasArg = true;
+    p.mandatory = true;
+    pl.push_back(p);
+
     return pl;
 }
 
@@ -73,6 +79,13 @@
          i != params.end(); ++i) {
         if (i->first == "network") {
             m_network = true;
+        } else if (i->first == "format") {
+            if (i->second == "jams") {
+                m_format = i->second;
+            } else {
+                throw std::runtime_error
+                    ("Unknown or invalid --json-format parameter \"" + i->second + "\"");
+            }
         }
     }
 }