#include "autocomplete.hpp" #include "servers.hpp" #include "config.hpp" #include "templates.hpp" #include "services.hpp" #include "servers.hpp" #include #include #include namespace autocomplete { const std::set system_commands_noargs = {"templates","autocomplete_list_servers","autocomplete_list_services","autocomplete_list_commands"}; const std::set system_commands_always_available = {"help","edit"}; const std::set system_commands_require_config = {"server","templates","create-service","create-template","create-server","ssh","list"}; const std::set system_commands_hidden = {"nuke","_allservicesstatus"}; const std::set service_commands_require_config = {"ssh","edit","nuke","_allservicesstatus"}; void merge_commands(std::set &commands, const std::set &new_commands) { commands.insert(new_commands.begin(), new_commands.end()); } bool is_no_arg_cmd(std::string cmd) { return system_commands_noargs.find(cmd) != system_commands_noargs.end(); } bool autocomplete(const std::vector &args) { if (args.size() < 3) // dropshell autocomplete ??? { autocomplete_list_commands(); return true; } ASSERT(args.size() >= 3, "Invalid number of arguments"); std::string cmd = args[2]; // std::cout<<" cmd = ["< { auto servers = dropshell::get_configured_servers(); for (const auto& server : servers) std::cout << server.get_server_name() << std::endl; return true; } if (args.size()==4) // we have the command and the server. dropshell autocomplete command server { std::string server = args[3]; if (cmd=="create-service") { // create-service