forked from janek/mostr
1
0
Fork 0

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();
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)) => {