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