src/relpipe-tr-grep.cpp
branchv_0
changeset 24 c69670b7b4ef
parent 18 5a3602fb1649
child 25 98be80d2e65b
--- a/src/relpipe-tr-grep.cpp	Sat Oct 24 00:08:19 2020 +0200
+++ b/src/relpipe-tr-grep.cpp	Tue May 11 18:30:50 2021 +0200
@@ -31,10 +31,11 @@
 #include <relpipe/writer/Factory.h>
 #include <relpipe/writer/TypeId.h>
 
+#include "Configuration.h"
+#include "CLIParser.h"
 #include "GrepHandler.h"
 
 using namespace relpipe::cli;
-using namespace relpipe::reader;
 using namespace relpipe::tr::grep;
 
 int main(int argc, char**argv) {
@@ -42,11 +43,15 @@
 	CLI::untieStdIO();
 	CLI cli(argc, argv);
 
+	CLIParser cliParser;
+	Configuration configuration = cliParser.parse(cli.arguments());
+
 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
 
 	try {
-		std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
-		GrepHandler handler(std::cout, cli.arguments());
+		std::shared_ptr<writer::RelationalWriter> writer(relpipe::writer::Factory::create(std::cout));
+		std::shared_ptr<RelationalReader> reader(relpipe::reader::Factory::create(std::cin));
+		GrepHandler handler(writer, configuration);
 		reader->addHandler(&handler);
 		reader->process();