diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-04-09 17:26:53 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:35 +0200 |
commit | 22c5c38618886bbafe21463edc6464a7bf8390e3 (patch) | |
tree | b162c01c560bcd88d2951134f65f65e1b8506b3a /src/cli | |
parent | 07f5bd313bd08aa8c0193c832b9219f72f2704f7 (diff) |
added flat option to command line interface.
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/Main.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cli/Main.cpp b/src/cli/Main.cpp index a32e946..1bd3725 100644 --- a/src/cli/Main.cpp +++ b/src/cli/Main.cpp @@ -80,7 +80,7 @@ const char *MSG_COPYING = const std::set<std::string> formats{"html", "xml"}; static void createOutput(Handle<Document> doc, std::ostream &out, - const std::string &format, Logger &logger, + const std::string &format, bool flat, Logger &logger, ResourceManager &resMgr) { if (format == "html") { @@ -88,7 +88,7 @@ static void createOutput(Handle<Document> doc, std::ostream &out, transform.writeHTML(doc, out, logger, true); } else if (format == "xml") { xml::XmlTransformer transform; - transform.writeXml(doc, out, logger, resMgr, true); + transform.writeXml(doc, out, logger, resMgr, true, flat); } } @@ -105,6 +105,7 @@ int main(int argc, char **argv) std::string inputPath; std::string outputPath; std::string format; + bool flat; #ifdef MANAGER_GRAPHVIZ_EXPORT std::string graphvizPath; #endif @@ -124,7 +125,10 @@ int main(int argc, char **argv) "output,o", po::value<std::string>(&outputPath), "The output file name. Per default the input file name will be used.")( "format,F", po::value<std::string>(&format)->required(), - "The output format that shall be produced." + "The output format that shall be produced.")( + "flat,f", po::bool_switch(&flat)->default_value(false), + "Works only for XML output. This serializes all referenced ontologies " + "and typesystems into the output file." #ifdef MANAGER_GRAPHVIZ_EXPORT )( "graphviz,G", po::value<std::string>(&graphvizPath), @@ -199,6 +203,9 @@ int main(int argc, char **argv) logger.error(f); } } + if(flat && format != "xml"){ + logger.warning("The \'flat\' option is only valid for xml output. It will be ignored."); + } // initialize global instances. Manager manager; @@ -262,9 +269,9 @@ int main(int argc, char **argv) // write output if (outputPath != "-") { std::ofstream out{outputPath}; - createOutput(doc, out, format, logger, resourceManager); + createOutput(doc, out, format, flat, logger, resourceManager); } else { - createOutput(doc, std::cout, format, logger, resourceManager); + createOutput(doc, std::cout, format, flat, logger, resourceManager); } return SUCCESS; |