camel_cli/template/
mod.rs1pub mod embedded;
2
3use std::fmt;
4
5#[derive(Clone, Copy, Debug, Default, PartialEq, clap::ValueEnum)]
6pub enum ProfileLayout {
7 Simple,
8 #[default]
9 Env,
10}
11
12impl fmt::Display for ProfileLayout {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 match self {
15 ProfileLayout::Simple => write!(f, "simple"),
16 ProfileLayout::Env => write!(f, "env"),
17 }
18 }
19}
20
21pub struct TemplateFile {
22 pub path: String,
23 pub content: String,
24}
25
26pub struct TemplateContext {
27 pub project_name: String,
28 pub profile_layout: ProfileLayout,
29}
30
31pub trait TemplateProvider {
32 fn name(&self) -> &str;
33 fn files(&self, ctx: &TemplateContext)
34 -> Result<Vec<TemplateFile>, Box<dyn std::error::Error>>;
35}