summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-05-15 14:37:15 +0100
committerJoe Carstairs <me@joeac.net>2026-05-15 14:39:59 +0100
commit2068342144fe093efba9b9ff080017d294da7b6d (patch)
treea4dd0ef5c6460deca4f588334215994b2c3d1cd0 /src/config.rs
parente433feddbe418b57e829ff86fba374a5d57990f2 (diff)
add anyhow, serde, toml, dirs
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..f27f5f9
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,22 @@
+use anyhow::Context;
+use serde::Deserialize;
+
+fn read_config(path: &str) -> anyhow::Result<Config> {
+ let toml = std::fs::read(path)
+ .with_context(|| format!("Failed to read config file at {path}"))?;
+ let config = toml::from_slice(&toml)
+ .with_context(|| format!("Failed to parse config file at {path}"))?;
+ Ok(config)
+}
+
+#[derive(Deserialize)]
+pub struct Config {
+ repositories: Vec<RepoConfig>,
+}
+
+#[derive(Deserialize)]
+pub struct RepoConfig {
+ remote_git_repo: String,
+ local_git_repo: String,
+ remote_package_repo: String,
+}