| 318 | } |
| 319 | |
| 320 | bool HandleInsertCommand(std::vector<std::string> const& args, |
| 321 | cmExecutionStatus& status) |
| 322 | { |
| 323 | if (args.size() < 4) { |
| 324 | status.SetError("sub-command INSERT requires at least three arguments."); |
| 325 | return false; |
| 326 | } |
| 327 | |
| 328 | std::string const& listName = args[1]; |
| 329 | |
| 330 | // expand the variable |
| 331 | int index; |
| 332 | if (!GetIndexArg(args[2], &index, status.GetMakefile())) { |
| 333 | status.SetError(cmStrCat("index: ", args[2], " is not a valid index")); |
| 334 | return false; |
| 335 | } |
| 336 | auto list = GetList(listName, status.GetMakefile()); |
| 337 | if (!list) { |
| 338 | list = cmList{}; |
| 339 | } |
| 340 | |
| 341 | try { |
| 342 | list->insert_items(index, args.begin() + 3, args.end(), |
| 343 | cmList::ExpandElements::No, cmList::EmptyElements::Yes); |
| 344 | status.GetMakefile().AddDefinition(listName, list->to_string()); |
| 345 | return true; |
| 346 | } catch (std::out_of_range& e) { |
| 347 | status.SetError(e.what()); |
| 348 | return false; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | bool HandleJoinCommand(std::vector<std::string> const& args, |
| 353 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…