use crate::config::models::ConfigModel;
use crate::config::Configuration;
use clap::Args;
use schemars::JsonSchema;
use serde::Deserialize;
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Args, JsonSchema)]
#[command(next_help_heading = "Tools")]
pub struct Tools {
#[serde(default)]
#[arg(env = "TRUNK_TOOLS_SASS")]
pub sass: Option<String>,
#[serde(default)]
#[arg(env = "TRUNK_TOOLS_WASM_BINDGEN")]
pub wasm_bindgen: Option<String>,
#[serde(default)]
#[arg(env = "TRUNK_TOOLS_WASM_OPT")]
pub wasm_opt: Option<String>,
#[serde(default)]
#[arg(env = "TRUNK_TOOLS_TAILWINDCSS")]
pub tailwindcss: Option<String>,
}
impl Tools {
pub fn apply_to(self, mut config: Configuration) -> anyhow::Result<Configuration> {
config.tools.sass = self.sass.or(config.tools.sass);
config.tools.wasm_bindgen = self.wasm_bindgen.or(config.tools.wasm_bindgen);
config.tools.wasm_opt = self.wasm_opt.or(config.tools.wasm_opt);
config.tools.tailwindcss = self.tailwindcss.or(config.tools.tailwindcss);
Ok(config)
}
}
impl ConfigModel for Tools {}