fix(main): revamp prompt formatting

This commit is contained in:
xeruf 2024-08-14 15:33:50 +03:00
parent 68d5c101e9
commit be582cb536
1 changed files with 10 additions and 11 deletions

View File

@ -299,17 +299,16 @@ async fn main() {
let mut lines = stdin().lines(); let mut lines = stdin().lines();
loop { loop {
println!(); println!();
selected_relay.as_ref().and_then(|url| relays.get(url)).inspect(|tasks| { let tasks = selected_relay.as_ref().and_then(|url| relays.get(url)).unwrap_or(&local_tasks);
print!( print!(
"{}", "{} {}) ",
selected_relay.as_ref().map_or("TEMP".to_string(), |url| url.to_string()).bright_black().italic(),
format!( format!(
"{} {}{}) ", "{}{}",
selected_relay.as_ref().map_or("local".to_string(), |url| url.to_string()),
tasks.get_task_path(tasks.get_position()), tasks.get_task_path(tasks.get_position()),
tasks.get_prompt_suffix() tasks.get_prompt_suffix()
).italic() ).bold()
); );
});
stdout().flush().unwrap(); stdout().flush().unwrap();
match lines.next() { match lines.next() {
Some(Ok(input)) => { Some(Ok(input)) => {