From 0234920446bf891c7d1d3f2d35f1561d3921341d Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Sat, 17 Jan 2026 17:28:20 +0530 Subject: [PATCH] Print g3 progress and status on same line - print_g3_progress now uses print! instead of println! - print_g3_status completes the line with just the status - Result: 'g3: compacting session ... [done]' on one line --- crates/g3-cli/src/ui_writer_impl.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/g3-cli/src/ui_writer_impl.rs b/crates/g3-cli/src/ui_writer_impl.rs index 6db13b3..41db99c 100644 --- a/crates/g3-cli/src/ui_writer_impl.rs +++ b/crates/g3-cli/src/ui_writer_impl.rs @@ -213,7 +213,8 @@ impl UiWriter for ConsoleUiWriter { fn print_g3_progress(&self, message: &str) { use crossterm::style::{Attribute, Color, ResetColor, SetAttribute, SetForegroundColor}; - println!( + use std::io::Write; + print!( "{}{}g3:{}{} {} ...", SetAttribute(Attribute::Bold), SetForegroundColor(Color::Green), @@ -221,29 +222,23 @@ impl UiWriter for ConsoleUiWriter { SetAttribute(Attribute::Reset), message ); + let _ = std::io::stdout().flush(); } fn print_g3_status(&self, message: &str, status: &str) { - use crossterm::style::{Attribute, Color, ResetColor, SetAttribute, SetForegroundColor}; + use crossterm::style::{Color, ResetColor, SetForegroundColor}; + let _ = message; // unused now - progress already printed the message let status_colored = if status.starts_with("error") || status == "failed" { format!( - "{}[{}]{}", + " {}[{}]{}", SetForegroundColor(Color::Red), status, ResetColor ) } else { - format!("[{}]", status) + format!(" [{}]", status) }; - println!( - "{}{}g3:{}{} {} ... {}", - SetAttribute(Attribute::Bold), - SetForegroundColor(Color::Green), - ResetColor, - SetAttribute(Attribute::Reset), - message, - status_colored - ); + println!("{}", status_colored); } fn print_context_thinning(&self, message: &str) {