You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
747 B
Rust
30 lines
747 B
Rust
use std::path::PathBuf;
|
|
use structopt::StructOpt;
|
|
mod srcstats;
|
|
use srcstats::get_summary_src_stats;
|
|
mod errors;
|
|
use errors::StatsError;
|
|
#[derive(Debug, StructOpt)]
|
|
#[structopt(
|
|
name = "rstat",
|
|
about = "This is a tool to generate statistics on Rust projects"
|
|
)]
|
|
struct Opt {
|
|
#[structopt(name = "source directory", parse(from_os_str))]
|
|
in_dir: PathBuf,
|
|
#[structopt(name = "mode", short)]
|
|
mode: String,
|
|
}
|
|
fn main() -> Result<(), StatsError> {
|
|
let opt = Opt::from_args();
|
|
let mode = &opt.mode[..];
|
|
match mode {
|
|
"src" => {
|
|
let stats = get_summary_src_stats(&opt.in_dir)?;
|
|
println!("Summary stats: {:?}", stats);
|
|
}
|
|
_ => println!("Sorry, no stats"),
|
|
}
|
|
Ok(())
|
|
}
|