From ab7f99e061e54924899b778e929dd2e17c8792d9 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Fri, 6 Sep 2024 13:47:47 +0200 Subject: add root index and directory creation --- src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1fdcebf..e0b3758 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,21 @@ use backup::Backup; use config::Config; use packages::{pacman::Pacman, PackageManager}; -use storage::save_index; mod backup; mod config; mod error; mod pathinfo; mod packages; -mod storage; -fn main() -> anyhow::Result<()> { +fn main() -> color_eyre::Result<()> { + color_eyre::install()?; + let mut cfg = Config::load()?; cfg.user.push("fx".to_string()); cfg.directories.push("~/.config/nvim".to_string()); cfg.directories.push("~/.config/hypr".to_string()); - let toml = toml::to_string(&cfg)?; - println!("{toml}"); + cfg.root = "./backup".to_string(); let pacman = Pacman; let pkgs = pacman.get_installed(); @@ -24,7 +23,9 @@ fn main() -> anyhow::Result<()> { let backup = Backup::create(&cfg, pkgs)?; // println!("{backup:#?}"); - save_index(backup); + backup.save(&cfg)?; + + Backup::get(&cfg, None)?; // let fi = FileInfo::new("~/.config/nvim", &cfg)?; // println!("{:?}", fi.get_absolute_path()); -- cgit v1.2.3