mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 00:00:05 +03:00
Add a special confirmation for initialization in a workspace
This commit is contained in:
parent
f5737b5a49
commit
82ebd29ff6
|
@ -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");
|
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
|
// Make sure "rustlings" is added to `workspace.members` by making
|
||||||
// Cargo initialize a new project.
|
// Cargo initialize a new project.
|
||||||
let status = Command::new("cargo")
|
let status = Command::new("cargo")
|
||||||
|
@ -76,10 +79,10 @@ pub fn init() -> Result<()> {
|
||||||
fs::remove_dir_all("rustlings")
|
fs::remove_dir_all("rustlings")
|
||||||
.context("Failed to remove the temporary directory `rustlings/`")?;
|
.context("Failed to remove the temporary directory `rustlings/`")?;
|
||||||
init_git = false;
|
init_git = false;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
stdout.write_all(b"This command will create the directory `rustlings/` which will contain the exercises.\nPress ENTER to continue ")?;
|
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)?;
|
press_enter_prompt(&mut stdout)?;
|
||||||
|
}
|
||||||
|
|
||||||
create_dir(rustlings_dir).context("Failed to create the `rustlings/` directory")?;
|
create_dir(rustlings_dir).context("Failed to create the `rustlings/` directory")?;
|
||||||
set_current_dir(rustlings_dir)
|
set_current_dir(rustlings_dir)
|
||||||
|
|
Loading…
Reference in a new issue