| 136 | } |
| 137 | |
| 138 | void parseArguments(std::vector<std::string> const& args, |
| 139 | ParsedArguments& parsedArguments) |
| 140 | { |
| 141 | ExpectedOptions const expectedOptions = getExpectedOptions(); |
| 142 | size_t i = 0; |
| 143 | |
| 144 | // at this point we know that args vector is not empty |
| 145 | |
| 146 | // if first argument is not one of expected options it's source group name |
| 147 | if (!isExpectedOption(args[0], expectedOptions)) { |
| 148 | // get source group name and go to next argument |
| 149 | parsedArguments[kSourceGroupOptionName].push_back(args[0]); |
| 150 | ++i; |
| 151 | } |
| 152 | |
| 153 | for (; i < args.size();) { |
| 154 | // get current option and increment index to go to next argument |
| 155 | std::string const& currentOption = args[i++]; |
| 156 | |
| 157 | // create current option entry in parsed arguments |
| 158 | std::vector<std::string>& currentOptionArguments = |
| 159 | parsedArguments[currentOption]; |
| 160 | |
| 161 | // collect option arguments while we won't find another expected option |
| 162 | while (i < args.size() && !isExpectedOption(args[i], expectedOptions)) { |
| 163 | currentOptionArguments.push_back(args[i++]); |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | } // namespace |
| 169 |
no test coverage detected
searching dependent graphs…