src/CLIParser.h
branchv_0
changeset 52 fea625f0a096
parent 31 c64e1588f428
equal deleted inserted replaced
51:841845ccf06d 52:fea625f0a096
    53 	static const string_t OPTION_XATTR;
    53 	static const string_t OPTION_XATTR;
    54 	static const string_t OPTION_STREAMLET;
    54 	static const string_t OPTION_STREAMLET;
    55 	static const string_t OPTION_AS;
    55 	static const string_t OPTION_AS;
    56 	static const string_t OPTION_OPTION;
    56 	static const string_t OPTION_OPTION;
    57 	static const string_t OPTION_RELATION;
    57 	static const string_t OPTION_RELATION;
       
    58 	static const string_t OPTION_PARALLEL;
    58 
    59 
    59 	Configuration parse(const std::vector<string_t>& arguments) {
    60 	Configuration parse(const std::vector<string_t>& arguments) {
    60 		Configuration c;
    61 		Configuration c;
    61 
    62 
    62 		{
    63 		{
    77 				} else if (option == OPTION_OPTION) {
    78 				} else if (option == OPTION_OPTION) {
    78 					currentOptions.push_back(readNext(arguments, i));
    79 					currentOptions.push_back(readNext(arguments, i));
    79 					currentOptions.push_back(readNext(arguments, i));
    80 					currentOptions.push_back(readNext(arguments, i));
    80 				} else if (option == OPTION_RELATION) {
    81 				} else if (option == OPTION_RELATION) {
    81 					c.relation = readNext(arguments, i);
    82 					c.relation = readNext(arguments, i);
       
    83 				} else if (option == OPTION_PARALLEL) {
       
    84 					c.parallelism = std::stoi(readNext(arguments, i));
       
    85 					if (c.parallelism < 1) throw relpipe::cli::RelpipeCLIException(L"Number of parallel processes must be 1 or more.", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    82 				} else {
    86 				} else {
    83 					throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    87 					throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    84 				}
    88 				}
    85 			}
    89 			}
    86 
    90 
   117 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   121 const string_t CLIParser::OPTION_XATTR = L"--" + RequestedField::GROUP_XATTR;
   118 const string_t CLIParser::OPTION_STREAMLET = L"--" + RequestedField::GROUP_STREAMLET;
   122 const string_t CLIParser::OPTION_STREAMLET = L"--" + RequestedField::GROUP_STREAMLET;
   119 const string_t CLIParser::OPTION_AS = L"--as";
   123 const string_t CLIParser::OPTION_AS = L"--as";
   120 const string_t CLIParser::OPTION_OPTION = L"--option";
   124 const string_t CLIParser::OPTION_OPTION = L"--option";
   121 const string_t CLIParser::OPTION_RELATION = L"--relation";
   125 const string_t CLIParser::OPTION_RELATION = L"--relation";
       
   126 const string_t CLIParser::OPTION_PARALLEL = L"--parallel";
   122 
   127 
   123 }
   128 }
   124 }
   129 }
   125 }
   130 }