equal
deleted
inserted
replaced
28 #include <relpipe/writer/TypeId.h> |
28 #include <relpipe/writer/TypeId.h> |
29 |
29 |
30 #include <relpipe/cli/CLI.h> |
30 #include <relpipe/cli/CLI.h> |
31 |
31 |
32 #include "CSVCommand.h" |
32 #include "CSVCommand.h" |
|
33 #include "CLIParser.h" |
|
34 #include "Configuration.h" |
33 |
35 |
34 using namespace std; |
36 using namespace std; |
35 using namespace relpipe::cli; |
37 using namespace relpipe::cli; |
36 using namespace relpipe::writer; |
38 using namespace relpipe::writer; |
37 using namespace relpipe::in::csv; |
39 using namespace relpipe::in::csv; |
42 CLI cli(argc, argv); |
44 CLI cli(argc, argv); |
43 |
45 |
44 int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; |
46 int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; |
45 |
47 |
46 try { |
48 try { |
|
49 CLIParser cliParser; |
|
50 Configuration configuration = cliParser.parse(cli.arguments()); |
47 CSVCommand command; |
51 CSVCommand command; |
48 std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout)); |
52 std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout)); |
49 command.process(cin, cli.arguments(), writer); |
53 command.process(cin, writer, configuration); |
50 resultCode = CLI::EXIT_CODE_SUCCESS; |
54 resultCode = CLI::EXIT_CODE_SUCCESS; |
51 } catch (RelpipeWriterException e) { |
55 } catch (RelpipeWriterException e) { |
52 fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str()); |
56 fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str()); |
53 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
57 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
54 resultCode = CLI::EXIT_CODE_DATA_ERROR; |
58 resultCode = CLI::EXIT_CODE_DATA_ERROR; |