Set up the flake repo directory.

This commit is contained in:
Tom Alexander
2026-02-14 16:00:37 -05:00
parent 9344e5708f
commit 7ec243e3e4
11 changed files with 449 additions and 19 deletions

View File

@@ -12,16 +12,23 @@ use super::Config;
pub(crate) struct TargetConfig {
pub(super) name: String,
#[serde(default)]
pub(super) repo: Option<String>,
pub(super) repo: String,
#[serde(default)]
pub(super) branch: Option<String>,
#[serde(default)]
pub(super) revision: Option<String>,
#[serde(default)]
pub(super) path: Option<String>,
#[serde(default)]
pub(super) attr: Option<String>,
#[serde(default)]
pub(super) update: Option<bool>,
#[serde(default)]
pub(super) update_branch: Option<String>,
}
@@ -42,4 +49,20 @@ impl TargetConfig {
let target_directory = self.get_target_directory(config_root)?;
Ok(Cow::Owned(target_directory.join("flake")))
}
pub(crate) fn get_repo(&'_ self) -> Result<&String, CustomError> {
Ok(&self.repo)
}
pub(crate) fn get_branch(&'_ self) -> Result<Cow<'_, str>, CustomError> {
if let Some(b) = &self.branch {
Ok(Cow::Borrowed(b))
} else {
Ok(Cow::Borrowed("main"))
}
}
pub(crate) fn get_revision(&self) -> Result<&Option<String>, CustomError> {
Ok(&self.revision)
}
}