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

41 lines
1.0 KiB
Rust
Raw Normal View History

2022-12-18 14:47:28 +01:00
mod code;
mod network;
2022-12-18 15:06:12 +01:00
mod perf;
2022-12-18 14:59:55 +01:00
mod procs;
2022-12-18 15:03:26 +01:00
mod storage;
2022-12-18 14:47:28 +01:00
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")
2022-12-18 14:59:55 +01:00
.subcommands(&[
code::Code::cmd()?,
network::Network::cmd()?,
procs::Procs::cmd()?,
2022-12-18 15:03:26 +01:00
storage::Storage::cmd()?,
2022-12-18 15:06:12 +01:00
perf::Perf::cmd()?,
2022-12-18 14:59:55 +01:00
])
2022-12-18 14:47:28 +01:00
.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),
2022-12-18 14:59:55 +01:00
Some(("procs", args)) => procs::Procs::exec(args),
2022-12-18 15:03:26 +01:00
Some(("storage", args)) => storage::Storage::exec(args),
2022-12-18 15:06:12 +01:00
Some(("perf", args)) => perf::Perf::exec(args),
2022-12-18 14:47:28 +01:00
_ => Stats::run(),
}
}
}