homesync/src/lib.rs

33 lines
692 B
Rust
Raw Normal View History

pub mod config;
2021-12-30 13:37:53 +00:00
pub mod daemon;
pub mod git;
pub mod path;
2021-12-29 16:49:24 +00:00
2021-12-30 13:37:53 +00:00
use config::PathConfig;
2022-01-07 11:11:25 +00:00
use std::error::Error;
type Result = std::result::Result<(), Box<dyn Error>>;
pub fn run_daemon(config: PathConfig, freq_secs: u64) -> Result {
let repo = git::init(&config)?;
daemon::launch(config, repo, freq_secs)?;
2021-12-30 13:37:53 +00:00
Ok(())
}
pub fn run_list(config: PathConfig) -> Result {
config::list_packages(config);
2021-12-30 13:37:53 +00:00
Ok(())
}
pub fn run_push(config: PathConfig) -> Result {
let mut repo = git::init(&config)?;
git::push(&config, &mut repo)?;
Ok(())
}
2022-01-07 11:32:34 +00:00
pub fn run_stage(config: PathConfig) -> Result {
let repo = git::init(&config)?;
git::stage(&config, &repo)?;
Ok(())
}