src/relpipe-in-filesystem.cpp
branchv_0
changeset 4 d44ed75822e7
parent 0 467d09b62a12
child 10 3e1608320b6c
equal deleted inserted replaced
3:62eac7ab4cf4 4:d44ed75822e7
     1 /**
     1 /**
     2  * Relational pipes
     2  * Relational pipes
     3  * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
     3  * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
     4  *
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     8  * (at your option) any later version.
    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 "FilesystemCommand.h"
    32 #include "FilesystemCommand.h"
       
    33 #include "CLIParser.h"
    33 
    34 
    34 using namespace relpipe::cli;
    35 using namespace relpipe::cli;
    35 using namespace relpipe::writer;
    36 using namespace relpipe::writer;
    36 using namespace relpipe::in::filesystem;
    37 using namespace relpipe::in::filesystem;
    37 
    38 
    41 	CLI cli(argc, argv);
    42 	CLI cli(argc, argv);
    42 
    43 
    43 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    44 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    44 
    45 
    45 	try {
    46 	try {
       
    47 		CLIParser cliParser;
       
    48 		Configuration configuration = cliParser.parse(cli.arguments());
    46 		FilesystemCommand command;
    49 		FilesystemCommand command;
    47 		command.process(cin, cout);
    50 		command.process(cin, cout, configuration);
    48 		resultCode = CLI::EXIT_CODE_SUCCESS;
    51 		resultCode = CLI::EXIT_CODE_SUCCESS;
    49 	} catch (RelpipeWriterException e) {
    52 	} catch (RelpipeWriterException e) {
    50 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    53 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str());
    51 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    54 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
    52 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
    55 		resultCode = CLI::EXIT_CODE_DATA_ERROR;