35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace dropshell {
|
|
|
|
class template_info {
|
|
public:
|
|
std::string name;
|
|
std::string 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.
|
|
|
|
|
|
bool get_templates(std::vector<template_info>& templates);
|
|
bool get_template_info(const std::string& 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);
|
|
|
|
} // namespace dropshell
|