mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-05-15 17:58:44 +00:00
Show current exercise on hint command
This commit is contained in:
parent
95499f18dd
commit
f403d9e1b6
@ -2,6 +2,10 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Show the file link of the current exercise when running `rustlings hint`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix integer overflow on big terminal widths [@gabfec](https://github.com/gabfec)
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@ -156,7 +156,15 @@ fn main() -> Result<ExitCode> {
|
||||
if let Some(name) = name {
|
||||
app_state.set_current_exercise_by_name(&name)?;
|
||||
}
|
||||
println!("{}", app_state.current_exercise().hint);
|
||||
|
||||
let current_exercise = app_state.current_exercise();
|
||||
let mut stdout = io::stdout().lock();
|
||||
stdout.write_all(b"Current exercise: ")?;
|
||||
current_exercise.terminal_file_link(&mut stdout, app_state.emit_file_links())?;
|
||||
|
||||
stdout.write_all(b"\n\nHint:\n")?;
|
||||
stdout.write_all(current_exercise.hint.as_bytes())?;
|
||||
stdout.write_all(b"\n")?;
|
||||
}
|
||||
// Handled in an earlier match.
|
||||
Some(Command::Init | Command::Dev(_)) => (),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user