diff options
| author | mo8it <mo8it@proton.me> | 2024-08-09 01:14:08 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-08-09 01:14:08 +0200 |
| commit | 82ebd29ff603b1f62c4e17f0f0c85cfcf05e70a0 (patch) | |
| tree | d92c20a785b792afa8ff0219251324c3da946799 /src/init.rs | |
| parent | f5737b5a49f6dfafbefda74df05ca1a93cdec94a (diff) | |
Add a special confirmation for initialization in a workspace
Diffstat (limited to 'src/init.rs')
| -rw-r--r-- | src/init.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/init.rs b/src/init.rs index 62a670d..5e876d6 100644 --- a/src/init.rs +++ b/src/init.rs @@ -57,6 +57,9 @@ pub fn init() -> Result<()> { bail!("The current directory is already part of a Cargo project.\nPlease initialize Rustlings in a different directory"); } + stdout.write_all(b"This command will create the directory `rustlings/` as a member of this Cargo workspace.\nPress ENTER to continue ")?; + press_enter_prompt(&mut stdout)?; + // Make sure "rustlings" is added to `workspace.members` by making // Cargo initialize a new project. let status = Command::new("cargo") @@ -76,11 +79,11 @@ pub fn init() -> Result<()> { fs::remove_dir_all("rustlings") .context("Failed to remove the temporary directory `rustlings/`")?; init_git = false; + } else { + stdout.write_all(b"This command will create the directory `rustlings/` which will contain the exercises.\nPress ENTER to continue ")?; + press_enter_prompt(&mut stdout)?; } - stdout.write_all(b"This command will create the directory `rustlings/` which will contain the exercises.\nPress ENTER to continue ")?; - press_enter_prompt(&mut stdout)?; - create_dir(rustlings_dir).context("Failed to create the `rustlings/` directory")?; set_current_dir(rustlings_dir) .context("Failed to change the current directory to `rustlings/`")?; |
