Skip to content

Commit fc6f820

Browse files
committed
feat(push): colorize push status string
Using color is meant to help distinguish the status string, e.g. "(modified)" or "(empty)" from the preceding patch name.
1 parent 2868ffe commit fc6f820

File tree

1 file changed

+13
-6
lines changed
  • src/stack/transaction

1 file changed

+13
-6
lines changed

src/stack/transaction/ui.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,22 @@ impl TransactionUserInterface {
192192
output.reset()?;
193193

194194
let status_str = match status {
195-
PushStatus::New => " (new)",
196-
PushStatus::AlreadyMerged => " (merged)",
197-
PushStatus::Conflict => " (conflict)",
198-
PushStatus::Empty => " (empty)",
199-
PushStatus::Modified => " (modified)",
195+
PushStatus::New => "(new)",
196+
PushStatus::AlreadyMerged => "(merged)",
197+
PushStatus::Conflict => "(conflict)",
198+
PushStatus::Empty => "(empty)",
199+
PushStatus::Modified => "(modified)",
200200
PushStatus::Unmodified => "",
201201
};
202202

203-
writeln!(output, "{status_str}")?;
203+
if status_str.is_empty() {
204+
writeln!(output)?;
205+
} else {
206+
color_spec.clear();
207+
output.set_color(color_spec.set_fg(Some(termcolor::Color::Yellow)))?;
208+
writeln!(output, " {status_str}")?;
209+
output.reset()?;
210+
}
204211
if is_last {
205212
self.printed_top = true;
206213
}

0 commit comments

Comments
 (0)