src/relpipe-in-cli.cpp
branchv_0
changeset 42 09cd32a65709
parent 37 27f0ffa712d9
child 43 3c8ea5dcf793
equal deleted inserted replaced
41:0776c8c94dae 42:09cd32a65709
    25 #include <relpipe/cli/CLI.h>
    25 #include <relpipe/cli/CLI.h>
    26 #include <relpipe/cli/RelpipeCLIException.h>
    26 #include <relpipe/cli/RelpipeCLIException.h>
    27 
    27 
    28 #include "Command.h"
    28 #include "Command.h"
    29 #include "ArgumentsCommand.h"
    29 #include "ArgumentsCommand.h"
    30 #include "DemoCommand.h"
       
    31 #include "StdInCommand.h"
    30 #include "StdInCommand.h"
    32 
    31 
    33 using namespace relpipe::cli;
    32 using namespace relpipe::cli;
    34 using namespace relpipe::in::cli;
    33 using namespace relpipe::in::cli;
    35 using namespace relpipe::writer;
    34 using namespace relpipe::writer;
    36 
    35 
    37 Command* findCommand(string_t commandName) {
    36 Command* findCommand(string_t commandName) {
    38 	// TODO: better command names
    37 	// TODO: better command names
    39 	// TODO: help command
    38 	// TODO: help command
    40 	if (commandName == L"demo") return new DemoCommand();
    39 	if (commandName == L"generate") return new ArgumentsCommand();
    41 	else if (commandName == L"generate") return new ArgumentsCommand();
       
    42 	else if (commandName == L"generate-without-stdin") return new StdInCommand(false); // TODO: just for testing, StdInCommand(false) should work same as ArgumentsCommand()
    40 	else if (commandName == L"generate-without-stdin") return new StdInCommand(false); // TODO: just for testing, StdInCommand(false) should work same as ArgumentsCommand()
    43 	else if (commandName == L"generate-from-stdin") return new StdInCommand(true);
    41 	else if (commandName == L"generate-from-stdin") return new StdInCommand(true);
    44 	else throw RelpipeCLIException(L"Unknown command: " + commandName, CLI::EXIT_CODE_UNKNOWN_COMMAND);
    42 	else throw RelpipeCLIException(L"Unknown command: " + commandName, CLI::EXIT_CODE_UNKNOWN_COMMAND);
    45 }
    43 }
    46 
    44