Change /dump output to use g3 status formatting

Replace '📄 Context dumped to: <filename>' with 'g3: context dumped to <filename> [done]'
where g3: is bold green, filename is cyan, and [done] is bold green.

Add G3Status::complete_with_path() method for status messages with highlighted paths.
This commit is contained in:
Dhanji R. Prasanna
2026-01-20 21:43:48 +05:30
parent 1a1f149206
commit 9eb8931fab
2 changed files with 24 additions and 1 deletions

View File

@@ -196,7 +196,13 @@ pub async fn handle_command<W: UiWriter>(
} }
match std::fs::write(&dump_path, &dump_content) { match std::fs::write(&dump_path, &dump_content) {
Ok(_) => output.print(&format!("📄 Context dumped to: {}", dump_path.display())), Ok(_) => {
G3Status::complete_with_path(
"context dumped to",
&dump_path.display().to_string(),
Status::Done,
);
}
Err(e) => output.print(&format!("❌ Failed to write dump: {}", e)), Err(e) => output.print(&format!("❌ Failed to write dump: {}", e)),
} }
Ok(true) Ok(true)

View File

@@ -289,6 +289,23 @@ impl G3Status {
Self::complete(&format!("{} ... {}%", scope_desc, result.before_percentage), Status::NoChanges); Self::complete(&format!("{} ... {}%", scope_desc, result.before_percentage), Status::NoChanges);
} }
} }
/// Print a complete status message with a path highlighted in cyan.
/// Format: "g3: <message> <path> [status]"
/// - "g3:" is bold green
/// - path is cyan
/// - status is formatted per Status type
pub fn complete_with_path(message: &str, path: &str, status: Status) {
print!(
"{} {} {}{}{}",
Self::format_prefix(),
message,
SetForegroundColor(Color::Cyan),
path,
ResetColor
);
Self::status(&status);
}
} }
#[cfg(test)] #[cfg(test)]