26 lines
814 B
Rust
26 lines
814 B
Rust
use sized::{scan_tree, ScanControl, ScanOptions};
|
|
use std::{error::Error, path::PathBuf};
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
let Some(path) = std::env::args_os().nth(1).map(PathBuf::from) else {
|
|
eprintln!("Usage: scan PATH");
|
|
std::process::exit(2);
|
|
};
|
|
let report = scan_tree(&path, &ScanOptions::default(), &ScanControl::default())?;
|
|
println!(
|
|
"apparent={} allocated={} entries={} complete={} issues={}",
|
|
report.root.size_bytes,
|
|
report.root.blocks * 512,
|
|
report.entries_scanned,
|
|
report.root.complete,
|
|
report.issues.len()
|
|
);
|
|
if !report.root.complete {
|
|
for issue in report.issues {
|
|
eprintln!("{}: {}", issue.path.display(), issue.message);
|
|
}
|
|
std::process::exit(1);
|
|
}
|
|
Ok(())
|
|
}
|