| 33 | } |
| 34 | |
| 35 | std::unordered_map<std::string, std::string> collect_key_value_args( |
| 36 | int argc, |
| 37 | char ** argv, |
| 38 | const std::string & name) { |
| 39 | std::unordered_map<std::string, std::string> values; |
| 40 | for (const auto & item : collect_args(argc, argv, name)) { |
| 41 | const auto pos = item.find('='); |
| 42 | if (pos == std::string::npos || pos == 0 || pos + 1 >= item.size()) { |
| 43 | throw std::runtime_error("expected " + name + " key=value, got: " + item); |
| 44 | } |
| 45 | values[item.substr(0, pos)] = item.substr(pos + 1); |
| 46 | } |
| 47 | return values; |
| 48 | } |
| 49 | |
| 50 | void set_option( |
| 51 | std::unordered_map<std::string, std::string> & options, |
no test coverage detected