mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Newline after resetting attributes
This commit is contained in:
parent
159273e532
commit
833e6e0c92
|
@ -31,8 +31,9 @@ fn run_bin(
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
if let Some(output) = output.as_deref_mut() {
|
if let Some(output) = output.as_deref_mut() {
|
||||||
write_ansi(output, SetAttribute(Attribute::Underlined));
|
write_ansi(output, SetAttribute(Attribute::Underlined));
|
||||||
output.extend_from_slice(b"Output\n");
|
output.extend_from_slice(b"Output");
|
||||||
write_ansi(output, ResetColor);
|
write_ansi(output, ResetColor);
|
||||||
|
output.push(b'\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
let success = cmd_runner.run_debug_bin(bin_name, output.as_deref_mut())?;
|
let success = cmd_runner.run_debug_bin(bin_name, output.as_deref_mut())?;
|
||||||
|
@ -44,8 +45,9 @@ fn run_bin(
|
||||||
// leaves the user confused about why the exercise isn't done yet.
|
// leaves the user confused about why the exercise isn't done yet.
|
||||||
write_ansi(output, SetAttribute(Attribute::Bold));
|
write_ansi(output, SetAttribute(Attribute::Bold));
|
||||||
write_ansi(output, SetForegroundColor(Color::Red));
|
write_ansi(output, SetForegroundColor(Color::Red));
|
||||||
output.extend_from_slice(b"The exercise didn't run successfully (nonzero exit code)\n");
|
output.extend_from_slice(b"The exercise didn't run successfully (nonzero exit code)");
|
||||||
write_ansi(output, ResetColor);
|
write_ansi(output, ResetColor);
|
||||||
|
output.push(b'\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,10 +148,11 @@ pub fn init() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout.queue(SetForegroundColor(Color::Green))?;
|
stdout.queue(SetForegroundColor(Color::Green))?;
|
||||||
stdout.write_all("Initialization done ✓\n\n".as_bytes())?;
|
stdout.write_all("Initialization done ✓".as_bytes())?;
|
||||||
stdout
|
stdout.queue(ResetColor)?;
|
||||||
.queue(ResetColor)?
|
stdout.write_all(b"\n\n")?;
|
||||||
.queue(SetAttribute(Attribute::Bold))?;
|
|
||||||
|
stdout.queue(SetAttribute(Attribute::Bold))?;
|
||||||
stdout.write_all(POST_INIT_MSG)?;
|
stdout.write_all(POST_INIT_MSG)?;
|
||||||
stdout.queue(ResetColor)?;
|
stdout.queue(ResetColor)?;
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,9 @@ impl<'a> WatchState<'a> {
|
||||||
Attributes::from(Attribute::Bold).with(Attribute::Underlined),
|
Attributes::from(Attribute::Bold).with(Attribute::Underlined),
|
||||||
))?
|
))?
|
||||||
.queue(SetForegroundColor(Color::Cyan))?;
|
.queue(SetForegroundColor(Color::Cyan))?;
|
||||||
stdout.write_all(b"Hint\n")?;
|
stdout.write_all(b"Hint")?;
|
||||||
stdout.queue(ResetColor)?;
|
stdout.queue(ResetColor)?;
|
||||||
|
stdout.write_all(b"\n")?;
|
||||||
|
|
||||||
stdout.write_all(self.app_state.current_exercise().hint.as_bytes())?;
|
stdout.write_all(self.app_state.current_exercise().hint.as_bytes())?;
|
||||||
stdout.write_all(b"\n\n")?;
|
stdout.write_all(b"\n\n")?;
|
||||||
|
@ -160,16 +161,17 @@ impl<'a> WatchState<'a> {
|
||||||
stdout
|
stdout
|
||||||
.queue(SetAttribute(Attribute::Bold))?
|
.queue(SetAttribute(Attribute::Bold))?
|
||||||
.queue(SetForegroundColor(Color::Green))?;
|
.queue(SetForegroundColor(Color::Green))?;
|
||||||
stdout.write_all("Exercise done ✓\n".as_bytes())?;
|
stdout.write_all("Exercise done ✓".as_bytes())?;
|
||||||
stdout.queue(ResetColor)?;
|
stdout.queue(ResetColor)?;
|
||||||
|
stdout.write_all(b"\n")?;
|
||||||
|
|
||||||
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
|
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
|
||||||
solution_link_line(stdout, solution_path)?;
|
solution_link_line(stdout, solution_path)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(
|
stdout.write_all(
|
||||||
stdout,
|
"When done experimenting, enter `n` to move on to the next exercise 🦀\n\n"
|
||||||
"When done experimenting, enter `n` to move on to the next exercise 🦀\n",
|
.as_bytes(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue