Reads a line from the console. If the console is interactive, this does fancy line editing and uses the given `prompt` and pre-fills the input with `previous`.
(
console: &mut dyn Console,
prompt: &str,
previous: &str,
history: Option<&mut Vec<String>>,
)
| 482 | /// Reads a line from the console. If the console is interactive, this does fancy line editing and |
| 483 | /// uses the given `prompt` and pre-fills the input with `previous`. |
| 484 | pub async fn read_line( |
| 485 | console: &mut dyn Console, |
| 486 | prompt: &str, |
| 487 | previous: &str, |
| 488 | history: Option<&mut Vec<String>>, |
| 489 | ) -> io::Result<String> { |
| 490 | if console.is_interactive() { |
| 491 | read_line_interactive(console, prompt, previous, history, true).await |
| 492 | } else { |
| 493 | read_line_raw(console).await |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /// Reads a line from the console without echo using the given `prompt`. |
| 498 | /// |