| 174 | } |
| 175 | |
| 176 | bool HandleRegexCommand(std::vector<std::string> const& args, |
| 177 | cmExecutionStatus& status) |
| 178 | { |
| 179 | if (args.size() < 2) { |
| 180 | status.SetError("sub-command REGEX requires a mode to be specified."); |
| 181 | return false; |
| 182 | } |
| 183 | std::string const& mode = args[1]; |
| 184 | if (mode == "MATCH") { |
| 185 | if (args.size() < 5) { |
| 186 | status.SetError("sub-command REGEX, mode MATCH needs " |
| 187 | "at least 5 arguments total to command."); |
| 188 | return false; |
| 189 | } |
| 190 | return RegexMatch(args, status); |
| 191 | } |
| 192 | if (mode == "MATCHALL") { |
| 193 | if (args.size() < 5) { |
| 194 | status.SetError("sub-command REGEX, mode MATCHALL needs " |
| 195 | "at least 5 arguments total to command."); |
| 196 | return false; |
| 197 | } |
| 198 | return RegexMatchAll(args, status); |
| 199 | } |
| 200 | if (mode == "REPLACE") { |
| 201 | if (args.size() < 6) { |
| 202 | status.SetError("sub-command REGEX, mode REPLACE needs " |
| 203 | "at least 6 arguments total to command."); |
| 204 | return false; |
| 205 | } |
| 206 | return RegexReplace(args, status); |
| 207 | } |
| 208 | if (mode == "QUOTE") { |
| 209 | if (args.size() < 4) { |
| 210 | status.SetError("sub-command REGEX, mode QUOTE needs " |
| 211 | "at least 4 arguments total to command."); |
| 212 | return false; |
| 213 | } |
| 214 | return RegexQuote(args, status); |
| 215 | } |
| 216 | |
| 217 | std::string e = "sub-command REGEX does not recognize mode " + mode; |
| 218 | status.SetError(e); |
| 219 | return false; |
| 220 | } |
| 221 | |
| 222 | bool RegexMatch(std::vector<std::string> const& args, |
| 223 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…