mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-24 22:47:32 -05:00
Disable init command during development
This commit is contained in:
parent
2e9b9a9f13
commit
1eac00e89a
2 changed files with 14 additions and 2 deletions
12
src/dev.rs
12
src/dev.rs
|
@ -1,6 +1,8 @@
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
|
|
||||||
|
use crate::DEVELOPING_OFFICIAL_RUSTLINGS;
|
||||||
|
|
||||||
mod check;
|
mod check;
|
||||||
mod init;
|
mod init;
|
||||||
mod update;
|
mod update;
|
||||||
|
@ -15,7 +17,13 @@ pub enum DevCommands {
|
||||||
impl DevCommands {
|
impl DevCommands {
|
||||||
pub fn run(self) -> Result<()> {
|
pub fn run(self) -> Result<()> {
|
||||||
match self {
|
match self {
|
||||||
DevCommands::Init => init::init().context(INIT_ERR),
|
DevCommands::Init => {
|
||||||
|
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
||||||
|
bail!("Disabled while developing the official Rustlings");
|
||||||
|
}
|
||||||
|
|
||||||
|
init::init().context(INIT_ERR)
|
||||||
|
}
|
||||||
DevCommands::Check => check::check(),
|
DevCommands::Check => check::check(),
|
||||||
DevCommands::Update => update::update(),
|
DevCommands::Update => update::update(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,10 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
Some(Subcommands::Init) => {
|
Some(Subcommands::Init) => {
|
||||||
|
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
||||||
|
bail!("Disabled while developing the official Rustlings");
|
||||||
|
}
|
||||||
|
|
||||||
return init::init().context("Initialization failed");
|
return init::init().context("Initialization failed");
|
||||||
}
|
}
|
||||||
Some(Subcommands::Dev(dev_command)) => return dev_command.run(),
|
Some(Subcommands::Dev(dev_command)) => return dev_command.run(),
|
||||||
|
|
Loading…
Reference in a new issue