This repository has been archived on 2023-01-14. You can view files and clone it, but cannot push or open issues or pull requests.
toolkit/crates/stats/src/lib.rs
2022-12-18 15:06:12 +01:00

41 lines
1.0 KiB
Rust

mod code;
mod network;
mod perf;
mod procs;
mod storage;
pub struct Stats;
impl Stats {
fn run() -> eyre::Result<()> {
Ok(())
}
}
impl util::Cmd for Stats {
fn cmd() -> eyre::Result<clap::Command> {
let cmd = clap::Command::new("stats")
.subcommands(&[
code::Code::cmd()?,
network::Network::cmd()?,
procs::Procs::cmd()?,
storage::Storage::cmd()?,
perf::Perf::cmd()?,
])
.subcommand_required(true);
Ok(cmd)
}
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
match args.subcommand() {
Some(("code", args)) => code::Code::exec(args),
Some(("network", args)) => network::Network::exec(args),
Some(("procs", args)) => procs::Procs::exec(args),
Some(("storage", args)) => storage::Storage::exec(args),
Some(("perf", args)) => perf::Perf::exec(args),
_ => Stats::run(),
}
}
}