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
use clap::Parser;

pub mod ls;
pub mod read;

#[derive(Debug, Parser)]
pub enum Cmd {
    /// List cached actions (transactions, simulations)
    Ls(ls::Cmd),
    /// Read cached action
    Read(read::Cmd),
}

#[derive(thiserror::Error, Debug)]
pub enum Error {
    #[error(transparent)]
    Ls(#[from] ls::Error),
    #[error(transparent)]
    Read(#[from] read::Error),
}

impl Cmd {
    pub fn run(&self) -> Result<(), Error> {
        match self {
            Cmd::Ls(cmd) => cmd.run()?,
            Cmd::Read(cmd) => cmd.run()?,
        };
        Ok(())
    }
}