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
This commit is contained in:
@@ -213,7 +213,8 @@ impl UiWriter for ConsoleUiWriter {
|
|||||||
|
|
||||||
fn print_g3_progress(&self, message: &str) {
|
fn print_g3_progress(&self, message: &str) {
|
||||||
use crossterm::style::{Attribute, Color, ResetColor, SetAttribute, SetForegroundColor};
|
use crossterm::style::{Attribute, Color, ResetColor, SetAttribute, SetForegroundColor};
|
||||||
println!(
|
use std::io::Write;
|
||||||
|
print!(
|
||||||
"{}{}g3:{}{} {} ...",
|
"{}{}g3:{}{} {} ...",
|
||||||
SetAttribute(Attribute::Bold),
|
SetAttribute(Attribute::Bold),
|
||||||
SetForegroundColor(Color::Green),
|
SetForegroundColor(Color::Green),
|
||||||
@@ -221,10 +222,12 @@ impl UiWriter for ConsoleUiWriter {
|
|||||||
SetAttribute(Attribute::Reset),
|
SetAttribute(Attribute::Reset),
|
||||||
message
|
message
|
||||||
);
|
);
|
||||||
|
let _ = std::io::stdout().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_g3_status(&self, message: &str, status: &str) {
|
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" {
|
let status_colored = if status.starts_with("error") || status == "failed" {
|
||||||
format!(
|
format!(
|
||||||
" {}[{}]{}",
|
" {}[{}]{}",
|
||||||
@@ -235,15 +238,7 @@ impl UiWriter for ConsoleUiWriter {
|
|||||||
} else {
|
} else {
|
||||||
format!(" [{}]", status)
|
format!(" [{}]", status)
|
||||||
};
|
};
|
||||||
println!(
|
println!("{}", status_colored);
|
||||||
"{}{}g3:{}{} {} ... {}",
|
|
||||||
SetAttribute(Attribute::Bold),
|
|
||||||
SetForegroundColor(Color::Green),
|
|
||||||
ResetColor,
|
|
||||||
SetAttribute(Attribute::Reset),
|
|
||||||
message,
|
|
||||||
status_colored
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_context_thinning(&self, message: &str) {
|
fn print_context_thinning(&self, message: &str) {
|
||||||
|
|||||||
Reference in New Issue
Block a user