| 135 | |
| 136 | |
| 137 | StringList Kernel::extractStageOptions(const StringList& cmdArgs) |
| 138 | { |
| 139 | StringList stringArgs; |
| 140 | OptionsMap& stageOptions = m_manager.stageOptions(); |
| 141 | |
| 142 | // Scan the argument vector for extra stage options. Pull them out and |
| 143 | // stick them in the list. Let the ProgramArgs handle everything else. |
| 144 | // NOTE: This depends on the format being "option=value" rather than |
| 145 | // "option value". This is what we've always expected, so no problem, |
| 146 | // but it would be better to be more flexible. |
| 147 | for (auto it = cmdArgs.begin(); it != cmdArgs.end(); ++it) |
| 148 | { |
| 149 | const std::string& cmd = *it; |
| 150 | |
| 151 | std::string stageName, opName, value; |
| 152 | auto res = parseStageOption(cmd, stageName, opName, value); |
| 153 | if (res == ParseStageResult::Unknown) |
| 154 | stringArgs.push_back(cmd); |
| 155 | else if (res == ParseStageResult::Invalid) |
| 156 | throw pdal_error("Stage option '" + cmd + "' not valid."); |
| 157 | else // ParseStageResult::Ok |
| 158 | { |
| 159 | if (value.empty()) |
| 160 | { |
| 161 | if (++it == cmdArgs.end()) |
| 162 | throw pdal_error("Stage option '" + stageName + "." + |
| 163 | opName + "' has no value."); |
| 164 | value = *it; |
| 165 | } |
| 166 | Option op(opName, value); |
| 167 | stageOptions[stageName].add(op); |
| 168 | } |
| 169 | } |
| 170 | return stringArgs; |
| 171 | } |
| 172 | |
| 173 | bool Kernel::doSwitches(const StringList& cmdArgs, ProgramArgs& args) |
| 174 | { |
nothing calls this directly
no test coverage detected