MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / findClosestCommand

Function findClosestCommand

tools/shell/embedded_shell.cpp:399–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399std::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
412int EmbeddedShell::processShellCommands(std::string lineStr) {
413 std::istringstream iss(lineStr);

Callers 2

processShellCommandsMethod · 0.85
printErrorMessageMethod · 0.85

Calls 1

Tested by

no test coverage detected