1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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(())
}
|