From 4c70fda118211f74426ecaba0a91efab1c262bcb Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Sat, 28 Oct 2023 15:40:27 +0200 Subject: [PATCH] Ajout : afficher un dollar dans stdout avant de taper une commande --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index 0e4d98d..2c49c57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use std::io; +use std::io::Write; mod parser; @@ -8,6 +9,11 @@ fn main() { while result_bytes_read.unwrap() != 0 { buffer.clear(); + + print!("$ "); + if io::stdout().flush().is_err() { + eprintln!("error: can't fully flush stdout or reached EOF"); + } result_bytes_read = io::stdin().read_line(&mut buffer); if !result_bytes_read.is_err() {