dropshell/src/commands/standard_autocomplete.cpp
Your Name 7e95779d98
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 19s
Install working
2025-05-11 16:26:25 +12:00

30 lines
788 B
C++

#include "shared_commands.hpp"
#include "command_registry.hpp"
#include "servers.hpp"
#include "services.hpp"
#include <libassert/assert.hpp>
namespace dropshell {
void std_autocomplete(const CommandContext &ctx)
{
ASSERT(ctx.args.size() > 0);
if (ctx.args.size() == 1) {
// list servers
std::vector<ServerInfo> servers = get_configured_servers();
for (const auto& server : servers) {
std::cout << server.name << std::endl;
}
}
else if (ctx.args.size() == 2) {
// list services
std::vector<LocalServiceInfo> services = get_server_services_info(ctx.args[2]);
for (const auto& service : services) {
std::cout << service.service_name << std::endl;
}
}
}
} // namespace dropshell