mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 23:10:30 +00:00
Add a special confirmation for initialization in a workspace
This commit is contained in:
parent
f5737b5a49
commit
82ebd29ff6
1 changed files with 6 additions and 3 deletions
|
@ -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/`")?;
|
||||
|
|
Loading…
Reference in a new issue