Set up the flake repo directory.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user