src/relpipe-out-xml.cpp
branchv_0
changeset 2 13a41e435ea0
parent 1 82ba555a97d1
child 3 878648aa663f
equal deleted inserted replaced
1:82ba555a97d1 2:13a41e435ea0
     1 #include <cstdlib>
     1 #include <cstdlib>
       
     2 #include <unistd.h>
     2 #include <memory>
     3 #include <memory>
     3 
     4 
     4 #include <relpipe/cli/CLI.h>
     5 #include <relpipe/cli/CLI.h>
     5 #include <relpipe/cli/RelpipeCLIException.h>
     6 #include <relpipe/cli/RelpipeCLIException.h>
     6 #include <relpipe/reader/Factory.h>
     7 #include <relpipe/reader/Factory.h>
    17 	CLI cli(argc, argv);
    18 	CLI cli(argc, argv);
    18 
    19 
    19 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    20 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
    20 
    21 
    21 	try {
    22 	try {
       
    23 
       
    24 		// TODO: color syntax highlighting if stdout is TTY:
       
    25 		// if (isatty(fileno(stdout))) std::cout << "color" << std::endl;
       
    26 		// else std::cout << "no-color" << std::endl;
       
    27 
    22 		std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
    28 		std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
    23 		XmlHandler handler(std::cout);
    29 		XmlHandler handler(std::cout);
    24 		reader->addHandler(&handler);
    30 		reader->addHandler(&handler);
    25 		reader->process();
    31 		reader->process();
    26 		resultCode = CLI::EXIT_CODE_SUCCESS;
    32 		resultCode = CLI::EXIT_CODE_SUCCESS;