use backup::Backup; use config::Config; use packages::{pacman::Pacman, PackageManager}; use tracing::{debug, info, level_filters::LevelFilter}; use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; mod backup; mod config; mod error; mod packages; mod pathinfo; fn main() -> color_eyre::Result<()> { color_eyre::install()?; let file_appender = tracing_appender::rolling::never("./", "arps.log"); let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender); tracing_subscriber::registry() .with( fmt::layer() .with_writer(non_blocking) .with_file(false) .with_ansi(false) .without_time(), ) .with(fmt::layer().with_file(false).without_time()) .with( EnvFilter::builder() .with_default_directive(LevelFilter::INFO.into()) .from_env_lossy(), ) .init(); debug!("logging initialized"); let mut cfg = Config::load()?; cfg.user.push("fx".to_string()); cfg.directories.push("~/.config/nvim".to_string()); cfg.root = "./backup".to_string(); let pacman = Pacman; let pkgs = pacman.get_installed()?; let backup = Backup::create(&cfg, pkgs); // info!(?backup); // pacman.install(vec![Package { // id: "lapce".to_string(), // version: "0.4.2-1".to_string(), // explicit: true, // }])?; Ok(()) }