You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dirstat/src/main.rs

57 lines
1.1 KiB

#![allow(dead_code)]
#[macro_use] extern crate pin_project;
#[macro_use] extern crate lazy_static;
use color_eyre::{
eyre::{
self,
eyre,
WrapErr as _,
},
Help as _,
SectionExt as _,
};
#[macro_use] mod ext;
pub use ext::prelude::*;
mod data;
4 years ago
mod config;
mod state;
mod arg;
4 years ago
mod work;
async fn read_config() -> eyre::Result<config::Config>
{
match arg::parse_args().wrap_err(eyre!("Failed to parse args"))?
{
arg::Mode::Normal(cfg) => {
#[cfg(debug_assertions)] eprintln!("Parsed config: {:#?}\n", cfg);
Ok(cfg)
},
arg::Mode::Help => arg::help(),
}
}
#[tokio::main]
async fn main() -> eyre::Result<()> {
color_eyre::install()?;
let state = state::State::new(read_config().await
.wrap_err(eyre!("Failed to load config"))?
.validate()
.wrap_err(eyre!("Invalid config"))
.with_suggestion(|| "Try running `--help`")?);
let graph = work::work_on_all(state).await;
let max_size = graph.directories().map(|x| x.size()).max();
println!("Max size: {:?}", max_size);
//println!("{:?}", graph);
Ok(())
}