src/CLIParser.h
branchv_0
changeset 17 b3c07fb178be
parent 16 3c51a2c32c86
child 24 884ece10575d
equal deleted inserted replaced
16:3c51a2c32c86 17:b3c07fb178be
    50 	static const string_t OPTION_RELATION;
    50 	static const string_t OPTION_RELATION;
    51 	static const string_t OPTION_PARAMETER;
    51 	static const string_t OPTION_PARAMETER;
    52 	static const string_t OPTION_COPY;
    52 	static const string_t OPTION_COPY;
    53 	static const string_t OPTION_COPY_RENAMED;
    53 	static const string_t OPTION_COPY_RENAMED;
    54 	static const string_t OPTION_FILE;
    54 	static const string_t OPTION_FILE;
    55 	static const string_t OPTION_KEEP_FILE;
    55 	static const string_t OPTION_FILE_KEEP;
    56 
    56 
    57 	Configuration parse(const std::vector<string_t>& arguments) {
    57 	Configuration parse(const std::vector<string_t>& arguments) {
    58 		Configuration c;
    58 		Configuration c;
    59 		Statement currentQuery;
    59 		Statement currentQuery;
    60 
    60 
    73 				c.copyRelations.push_back({readNext(arguments, i), L"", false});
    73 				c.copyRelations.push_back({readNext(arguments, i), L"", false});
    74 			} else if (option == OPTION_COPY_RENAMED) {
    74 			} else if (option == OPTION_COPY_RENAMED) {
    75 				c.copyRelations.push_back({readNext(arguments, i), readNext(arguments, i), true});
    75 				c.copyRelations.push_back({readNext(arguments, i), readNext(arguments, i), true});
    76 			} else if (option == OPTION_FILE) {
    76 			} else if (option == OPTION_FILE) {
    77 				c.file = readNext(arguments, i);
    77 				c.file = readNext(arguments, i);
    78 			} else if (option == OPTION_KEEP_FILE) {
    78 			} else if (option == OPTION_FILE_KEEP) {
    79 				string_t value = readNext(arguments, i);
    79 				string_t value = readNext(arguments, i);
    80 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    80 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    81 				else if (value == L"true") c.keepFile = KeepFile::Always;
    81 				else if (value == L"true") c.keepFile = KeepFile::Always;
    82 				else if (value == L"false") c.keepFile = KeepFile::Never;
    82 				else if (value == L"false") c.keepFile = KeepFile::Never;
    83 				else throw relpipe::cli::RelpipeCLIException(L"Unsupported keep-file value: " + value + L" Expecting: true, false, auto", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    83 				else throw relpipe::cli::RelpipeCLIException(L"Unsupported keep-file value: " + value + L" Expecting: true, false, auto", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    99 const string_t CLIParser::OPTION_RELATION = L"--relation";
    99 const string_t CLIParser::OPTION_RELATION = L"--relation";
   100 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   100 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   101 const string_t CLIParser::OPTION_COPY = L"--copy";
   101 const string_t CLIParser::OPTION_COPY = L"--copy";
   102 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   102 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   103 const string_t CLIParser::OPTION_FILE = L"--file";
   103 const string_t CLIParser::OPTION_FILE = L"--file";
   104 const string_t CLIParser::OPTION_KEEP_FILE = L"--keep-file";
   104 const string_t CLIParser::OPTION_FILE_KEEP = L"--file-keep";
   105 
   105 
   106 }
   106 }
   107 }
   107 }
   108 }
   108 }