relpipe-in-cli.cpp
branchv_0
changeset 16 70af16946466
parent 15 dc2121dec856
child 18 9e543fd0254c
equal deleted inserted replaced
15:dc2121dec856 16:70af16946466
     9 #include "CLI.h"
     9 #include "CLI.h"
    10 #include "RelpipeCLIException.h"
    10 #include "RelpipeCLIException.h"
    11 #include "Command.h"
    11 #include "Command.h"
    12 #include "ArgumentsCommand.h"
    12 #include "ArgumentsCommand.h"
    13 #include "DemoCommand.h"
    13 #include "DemoCommand.h"
       
    14 #include "StdInCommand.h"
    14 
    15 
    15 using namespace relpipe::cli;
    16 using namespace relpipe::cli;
    16 using namespace relpipe::in::cli;
    17 using namespace relpipe::in::cli;
    17 using namespace relpipe::writer;
    18 using namespace relpipe::writer;
    18 
    19 
    19 Command* findCommand(string_t commandName) {
    20 Command* findCommand(string_t commandName) {
       
    21 	// TODO: better command names
       
    22 	// TODO: help command
    20 	if (commandName == L"demo") return new DemoCommand();
    23 	if (commandName == L"demo") return new DemoCommand();
    21 	else if (commandName == L"generate") return new ArgumentsCommand();
    24 	else if (commandName == L"generate") return new ArgumentsCommand();
       
    25 	else if (commandName == L"generate-from-stdin") return new StdInCommand();
    22 	else throw RelpipeCLIException(L"Unknown command: " + commandName, CLI::EXIT_CODE_UNKNOWN_COMMAND);
    26 	else throw RelpipeCLIException(L"Unknown command: " + commandName, CLI::EXIT_CODE_UNKNOWN_COMMAND);
    23 }
    27 }
    24 
    28 
    25 int main(int argc, char** argv) {
    29 int main(int argc, char** argv) {
    26 	setlocale(LC_ALL, "");
    30 	setlocale(LC_ALL, "");