From be582cb5365c402b5f5e5a4f2e760e991114eb4d Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 14 Aug 2024 15:33:50 +0300 Subject: [PATCH] fix(main): revamp prompt formatting --- src/main.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 61e5590..4737786 100644 --- a/src/main.rs +++ b/src/main.rs @@ -299,17 +299,16 @@ async fn main() { let mut lines = stdin().lines(); loop { println!(); - selected_relay.as_ref().and_then(|url| relays.get(url)).inspect(|tasks| { - print!( - "{}", - format!( - "{} {}{}) ", - selected_relay.as_ref().map_or("local".to_string(), |url| url.to_string()), - tasks.get_task_path(tasks.get_position()), - tasks.get_prompt_suffix() - ).italic() - ); - }); + let tasks = selected_relay.as_ref().and_then(|url| relays.get(url)).unwrap_or(&local_tasks); + print!( + "{} {}) ", + selected_relay.as_ref().map_or("TEMP".to_string(), |url| url.to_string()).bright_black().italic(), + format!( + "{}{}", + tasks.get_task_path(tasks.get_position()), + tasks.get_prompt_suffix() + ).bold() + ); stdout().flush().unwrap(); match lines.next() { Some(Ok(input)) => {