.
This commit is contained in:
@ -1,35 +1,36 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
class template_info {
|
||||
public:
|
||||
template_info() {}
|
||||
template_info(std::string n, std::string p) : template_name(n), local_template_path(p) {}
|
||||
|
||||
std::string template_name;
|
||||
std::string local_template_path;
|
||||
std::string local_template_default_env_path;
|
||||
};
|
||||
|
||||
// templates are stored in two locations:
|
||||
// 1. /opt/dropshell/templates
|
||||
// 2. CONFIG_DIR/usertemplates (if it exists)
|
||||
// we aggregate the templates from both locations and return them in the order of priority.
|
||||
// if a template exists in both locations, the one in the user directory takes precedence.
|
||||
// the template name is just the subfolder name in the templates directory.
|
||||
// the template path is the path of that subfolder.
|
||||
// templates are stored in multiple locations:
|
||||
// 1. /opt/dropshell/templates
|
||||
// 2. CONFIG_DIR/templates
|
||||
|
||||
|
||||
bool get_templates(std::vector<template_info>& templates);
|
||||
bool get_template_info(const std::string& template_name, template_info& info);
|
||||
bool template_command_exists(const std::string& template_name,const std::string& command);
|
||||
void list_templates();
|
||||
bool get_templates(std::vector<template_info>& templates);
|
||||
bool get_template_info(const std::string& template_name, template_info& info);
|
||||
bool template_command_exists(const std::string& template_name,const std::string& command);
|
||||
void list_templates();
|
||||
|
||||
|
||||
// create a template
|
||||
// 1. create a new directory in the user templates directory
|
||||
// 2. copy the example template from the system templates directory into the new directory
|
||||
// 3. print out the README.txt file in the new template directory, and the path to the new template
|
||||
void create_template(const std::string& template_name);
|
||||
// create a template
|
||||
// 1. create a new directory in the user templates directory
|
||||
// 2. copy the example template from the system templates directory into the new directory
|
||||
// 3. print out the README.txt file in the new template directory, and the path to the new template
|
||||
void create_template(const std::string& template_name);
|
||||
|
||||
bool get_all_template_config_directories(std::vector<std::string>& template_config_directories);
|
||||
|
||||
} // namespace dropshell
|
||||
|
Reference in New Issue
Block a user