| 397 | } |
| 398 | |
| 399 | std::string findClosestCommand(std::string lineStr) { |
| 400 | std::string closestCommand = ""; |
| 401 | uint64_t editDistance = INT_MAX; |
| 402 | for (auto& command : shellCommand.commandList) { |
| 403 | auto distance = damerauLevenshteinDistance(command, lineStr); |
| 404 | if (distance < editDistance) { |
| 405 | editDistance = distance; |
| 406 | closestCommand = command; |
| 407 | } |
| 408 | } |
| 409 | return closestCommand; |
| 410 | } |
| 411 | |
| 412 | int EmbeddedShell::processShellCommands(std::string lineStr) { |
| 413 | std::istringstream iss(lineStr); |
no test coverage detected