# HG changeset patch # User František Kučera # Date 1547072296 -3600 # Node ID e83895da3e8f122e0f18240ad28723125f8a6fac # Parent 5eb4d149c6e25065b3a0291b2954af5fbc354001 optional custom relation name diff -r 5eb4d149c6e2 -r e83895da3e8f src/relpipe-in-csv.cpp --- a/src/relpipe-in-csv.cpp Wed Jan 09 23:04:51 2019 +0100 +++ b/src/relpipe-in-csv.cpp Wed Jan 09 23:18:16 2019 +0100 @@ -82,7 +82,7 @@ return false; } -void processDataStream(ostream &output, istream& input) { +void processDataStream(ostream &output, istream& input, const vector& args) { wstring_convert < codecvt_utf8> convertor; // UTF-8 is required for CSV std::shared_ptr writer(Factory::create(output)); vector metadata; @@ -101,7 +101,7 @@ metadata.push_back(am); if (lastInRecord) { headerDone = true; - writer->startRelation(L"csv", metadata, true); // TODO: support also custom relation name passed as CLI parameter + writer->startRelation(args.size() > 0 ? args[0] : L"csv", metadata, true); } } @@ -118,7 +118,7 @@ int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; try { - processDataStream(cout, cin); + processDataStream(cout, cin, cli.arguments()); resultCode = CLI::EXIT_CODE_SUCCESS; } catch (RelpipeWriterException e) { fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());