src/CLIParser.h
branchv_0
changeset 34 24c05e69d68f
parent 24 884ece10575d
child 37 3de41719d7eb
equal deleted inserted replaced
33:86ceb97db7de 34:24c05e69d68f
    52 	static const string_t OPTION_PARAMETER;
    52 	static const string_t OPTION_PARAMETER;
    53 	static const string_t OPTION_COPY;
    53 	static const string_t OPTION_COPY;
    54 	static const string_t OPTION_COPY_RENAMED;
    54 	static const string_t OPTION_COPY_RENAMED;
    55 	static const string_t OPTION_FILE;
    55 	static const string_t OPTION_FILE;
    56 	static const string_t OPTION_FILE_KEEP;
    56 	static const string_t OPTION_FILE_KEEP;
       
    57 	static const string_t OPTION_LIST_DATA_SOURCES;
    57 
    58 
    58 	Configuration parse(const std::vector<string_t>& arguments) {
    59 	Configuration parse(const std::vector<string_t>& arguments) {
    59 		Configuration c;
    60 		Configuration c;
    60 		Statement currentQuery;
    61 		Statement currentQuery;
    61 
    62 
    85 				string_t value = readNext(arguments, i);
    86 				string_t value = readNext(arguments, i);
    86 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    87 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    87 				else if (value == L"true") c.keepFile = KeepFile::Always;
    88 				else if (value == L"true") c.keepFile = KeepFile::Always;
    88 				else if (value == L"false") c.keepFile = KeepFile::Never;
    89 				else if (value == L"false") c.keepFile = KeepFile::Never;
    89 				else throw relpipe::cli::RelpipeCLIException(L"Unsupported keep-file value: " + value + L" Expecting: true, false, auto", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    90 				else throw relpipe::cli::RelpipeCLIException(L"Unsupported keep-file value: " + value + L" Expecting: true, false, auto", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
       
    91 			} else if (option == OPTION_LIST_DATA_SOURCES) {
       
    92 				c.listDataSources = true;
    90 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    93 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    91 		}
    94 		}
    92 		addQuery(c, currentQuery); // last relation
    95 		addQuery(c, currentQuery); // last relation
    93 
    96 
    94 		return c;
    97 		return c;
   107 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   110 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   108 const string_t CLIParser::OPTION_COPY = L"--copy";
   111 const string_t CLIParser::OPTION_COPY = L"--copy";
   109 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   112 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   110 const string_t CLIParser::OPTION_FILE = L"--file";
   113 const string_t CLIParser::OPTION_FILE = L"--file";
   111 const string_t CLIParser::OPTION_FILE_KEEP = L"--file-keep";
   114 const string_t CLIParser::OPTION_FILE_KEEP = L"--file-keep";
       
   115 const string_t CLIParser::OPTION_LIST_DATA_SOURCES = L"--list-data-sources";
   112 
   116 
   113 }
   117 }
   114 }
   118 }
   115 }
   119 }