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
39
40
41
42
43
use clap::{Args, Parser, Subcommand};
use diagnostic_quick::{QError, QResult};

use self::cmds::FsFlatten;

mod cmds;
pub mod utils;


#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct FSTools {
    #[command(subcommand)]
    cmds: Option<FSCommands>,
}

#[derive(Subcommand, Debug, Clone)]
pub enum FSCommands {
    Flatten(Box<FsFlatten>)
}

#[derive(Args, Debug, Clone)]
pub struct SharedArgs {
    #[arg(short, long)]
    execute: bool,
}

impl FSTools {
    pub fn run(&self) -> QResult<()> {
        match &self.cmds {
            None => {
                return Err(QError::runtime_error("No command specified"));
            }
            Some(cmd) => {
                match cmd {
                    FSCommands::Flatten(cmd) => {
                        cmd.run()
                    }
                }
            }
        }
    }
}