blob: 1430f11e55f674ab92567649c4fd5f3801cf945c (
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
26
27
28
29
30
31
32
33
34
|
use anyhow::{bail, Context, Result};
use clap::Subcommand;
use crate::DEVELOPING_OFFICIAL_RUSTLINGS;
mod check;
mod init;
mod update;
#[derive(Subcommand)]
pub enum DevCommands {
Init,
Check,
Update,
}
impl DevCommands {
pub fn run(self) -> Result<()> {
match self {
DevCommands::Init => {
if DEVELOPING_OFFICIAL_RUSTLINGS {
bail!("Disabled while developing the official Rustlings");
}
init::init().context(INIT_ERR)
}
DevCommands::Check => check::check(),
DevCommands::Update => update::update(),
}
}
}
const INIT_ERR: &str = "Initialization failed.
After resolving the issue, delete the `rustlings` directory (if it was created) and try again";
|