summaryrefslogtreecommitdiff
path: root/src/dev.rs
blob: 7905f3879ca86fe8831552bd9dc8d7b8958eccc8 (plain)
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
use anyhow::{Context, Result};
use clap::Subcommand;

use crate::info_file::InfoFile;

mod check;
mod init;

#[derive(Subcommand)]
pub enum DevCommands {
    Init,
    Check,
}

impl DevCommands {
    pub fn run(self, info_file: InfoFile) -> Result<()> {
        match self {
            DevCommands::Init => init::init().context(INIT_ERR),
            DevCommands::Check => check::check(info_file),
        }
    }
}

const INIT_ERR: &str = "Initialization failed.
After resolving the issue, delete the `rustlings` directory (if it was created) and try again";