1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-04-21 12:06:58 +02:00
rustlings/src/dev.rs

26 lines
562 B
Rust
Raw Normal View History

2024-04-16 03:08:45 +02:00
use anyhow::{Context, Result};
2024-04-15 23:54:57 +02:00
use clap::Subcommand;
2024-04-16 03:30:28 +02:00
use crate::info_file::InfoFile;
2024-04-15 23:54:57 +02:00
mod check;
mod init;
#[derive(Subcommand)]
pub enum DevCommands {
Init,
Check,
}
impl DevCommands {
2024-04-16 03:30:28 +02:00
pub fn run(self, info_file: InfoFile) -> Result<()> {
2024-04-15 23:54:57 +02:00
match self {
2024-04-16 03:08:45 +02:00
DevCommands::Init => init::init().context(INIT_ERR),
2024-04-16 03:30:28 +02:00
DevCommands::Check => check::check(info_file),
2024-04-15 23:54:57 +02:00
}
}
}
2024-04-16 03:08:45 +02:00
const INIT_ERR: &str = "Initialization failed.
After resolving the issue, delete the `rustlings` directory (if it was created) and try again";