summaryrefslogblamecommitdiff
path: root/src/main.rs
blob: e67e535d05552fc19aec2aa1aea04a56f6462f4f (plain) (tree)
1
2
3
4
5
6
7
8
9


                                               



           
             
             
 


                                     


                                                       
                                                          
                                      

                                                                               

                        
                                       

                                             
                               
 
                       
 

                                                                                                                                        
 


                                                  




                                                       
use backup::Backup;
use config::Config;
use packages::{pacman::Pacman, PackageManager};

mod backup;
mod config;
mod error;
mod packages;
mod pathinfo;

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());
    cfg.root = "./backup".to_string();
    // cfg.root = "./backup-test".to_string();
    // cfg.directories.push("u:/code/proj/fxbaup/backup-test-dir".to_string());

    let pacman = Pacman;
    let pkgs = pacman.get_installed()?;

    let backup = Backup::create(&cfg, pkgs)?;
    // println!("{backup:#?}");

    backup.save(&cfg)?;

    // PathInfo::compare_to_last_modified(&cfg, &LocationRoot::User("fx".to_string()), "code/proj/fxbaub/backup-test-dir/size.txt")?;
    // PathInfo::compare_to_last_modified(&cfg, &LocationRoot::User("fx".to_string()), "code/proj/fxbaub/backup-test-dir/content.txt")?;

    // let index = Backup::get_index(&cfg, None)?;

    // println!("{index:#?}");

    // let fi = FileInfo::new("~/.config/nvim", &cfg)?;
    // println!("{:?}", fi.get_absolute_path());
    Ok(())
}