with storage
This commit is contained in:
parent
db6f23440c
commit
45f617d7b5
@ -1,6 +1,7 @@
|
||||
mod code;
|
||||
mod network;
|
||||
mod procs;
|
||||
mod storage;
|
||||
|
||||
pub struct Stats;
|
||||
|
||||
@ -17,6 +18,7 @@ impl util::Cmd for Stats {
|
||||
code::Code::cmd()?,
|
||||
network::Network::cmd()?,
|
||||
procs::Procs::cmd()?,
|
||||
storage::Storage::cmd()?,
|
||||
])
|
||||
.subcommand_required(true);
|
||||
|
||||
@ -28,6 +30,7 @@ impl util::Cmd for Stats {
|
||||
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),
|
||||
_ => Stats::run(),
|
||||
}
|
||||
}
|
||||
|
29
crates/stats/src/storage.rs
Normal file
29
crates/stats/src/storage.rs
Normal file
@ -0,0 +1,29 @@
|
||||
pub struct Storage;
|
||||
|
||||
impl Storage {
|
||||
fn run() -> eyre::Result<()> {
|
||||
if let Err(_) = util::shell::run_with_input_and_output(&["dust", "--version"], "".into()) {
|
||||
return Err(eyre::anyhow!(
|
||||
"could not find dust, please install or add to PATH"
|
||||
));
|
||||
}
|
||||
|
||||
util::shell::run(&["dust"], None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl util::Cmd for Storage {
|
||||
fn cmd() -> eyre::Result<clap::Command> {
|
||||
let cmd = clap::Command::new("storage").subcommands(&[]);
|
||||
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
fn exec(args: &clap::ArgMatches) -> eyre::Result<()> {
|
||||
match args.subcommand() {
|
||||
_ => Storage::run(),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user