diff options
| author | Mo <76752051+mo8it@users.noreply.github.com> | 2024-04-18 13:02:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-18 13:02:35 +0200 |
| commit | 819dea250034a5658d0fe3306f6c35fc49961e17 (patch) | |
| tree | 122060cdc0ef3f81d367e0afc7b0e3e9d29d33ee /src/dev.rs | |
| parent | c613b70363c60c6f4305d09c7394c96cdc6b69e4 (diff) | |
| parent | 01e6732e4d920d9a1859e05fa28382e4307571af (diff) | |
Merge pull request #1949 from rust-lang/third-party-exercises
Support for third-party exercises
Diffstat (limited to 'src/dev.rs')
| -rw-r--r-- | src/dev.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/dev.rs b/src/dev.rs new file mode 100644 index 0000000..1430f11 --- /dev/null +++ b/src/dev.rs @@ -0,0 +1,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"; |
