-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathmod.rs
38 lines (34 loc) · 900 Bytes
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use clap::Parser;
pub mod actionlog;
pub mod clean;
pub mod path;
#[derive(Debug, Parser)]
pub enum Cmd {
/// Delete the cache
Clean(clean::Cmd),
/// Show the location of the cache
Path(path::Cmd),
/// Access details about cached actions like transactions, and simulations.
/// (Experimental. May see breaking changes at any time.)
#[command(subcommand)]
Actionlog(actionlog::Cmd),
}
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
Clean(#[from] clean::Error),
#[error(transparent)]
Path(#[from] path::Error),
#[error(transparent)]
Actionlog(#[from] actionlog::Error),
}
impl Cmd {
pub fn run(&self) -> Result<(), Error> {
match self {
Cmd::Clean(cmd) => cmd.run()?,
Cmd::Path(cmd) => cmd.run()?,
Cmd::Actionlog(cmd) => cmd.run()?,
};
Ok(())
}
}