#include "command_registry.hpp" #include "config.hpp" #include "utils/utils.hpp" #include "utils/directories.hpp" #include "shared_commands.hpp" #include "version.hpp" #include "utils/assert.hpp" #include "templates.hpp" #include #include #include #include #include namespace dropshell { void create_template_autocomplete(const CommandContext& ctx); int create_template_handler(const CommandContext& ctx); static std::vector create_template_name_list={"create-template"}; // Static registration struct CreateTemplateCommandRegister { CreateTemplateCommandRegister() { CommandRegistry::instance().register_command({ create_template_name_list, create_template_handler, create_template_autocomplete, false, // hidden true, // requires_config true, // requires_install 1, // min_args (after command) 1, // max_args (after command) "create-template TEMPLATE", "Create a new template.", // heredoc R"( Create a new template. create-template TEMPLATE )" }); } } create_template_command_register; void create_template_autocomplete(const CommandContext& ctx) { return; // can't autocomplete as it's a new server! } int create_template_handler(const CommandContext& ctx) { // create a new server entry on this host if (ctx.args.size() == 0) { error << "No template name provided" << std::endl; return 1; } bool ok = gTemplateManager().create_template(ctx.args[0]); return ok ? 0 : 1; } } // namespace dropshell