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