MCPcopy Create free account
hub / github.com/daniele77/cli / GetCompletionRecursiveHelper

Method GetCompletionRecursiveHelper

include/cli/cli.h:609–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607 }
608
609 std::vector<std::string> GetCompletionRecursiveHelper(const std::string& line, const std::string& prefix) const
610 {
611 auto rest = line;
612 rest.erase(0, prefix.size());
613 // trim_left(rest);
614 rest.erase(rest.begin(), std::find_if(rest.begin(), rest.end(), [](int ch) { return !std::isspace(ch); }));
615 std::vector<std::string> result;
616 for (const auto& cmd: *cmds)
617 {
618 auto cs = cmd->GetCompletionRecursive(rest);
619 for (const auto& c: cs)
620 result.push_back(prefix + ' ' + c); // concat submenu with command
621 }
622 if (parent != nullptr)
623 {
624 auto cs = parent->GetCompletionWithParent(rest);
625 for (const auto& c: cs)
626 result.push_back(prefix + ' ' + c); // concat submenu with command
627 }
628 return result;
629 }
630
631 /**
632 * Handles a command from the user input.

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected