Skip to content

Commit

Permalink
feat(push): colorize push status string
Browse files Browse the repository at this point in the history
Using color is meant to help distinguish the status string, e.g.
"(modified)" or "(empty)" from the preceding patch name.
  • Loading branch information
jpgrayson committed Aug 25, 2024
1 parent 2868ffe commit fc6f820
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/stack/transaction/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,22 @@ impl TransactionUserInterface {
output.reset()?;

let status_str = match status {
PushStatus::New => " (new)",
PushStatus::AlreadyMerged => " (merged)",
PushStatus::Conflict => " (conflict)",
PushStatus::Empty => " (empty)",
PushStatus::Modified => " (modified)",
PushStatus::New => "(new)",
PushStatus::AlreadyMerged => "(merged)",
PushStatus::Conflict => "(conflict)",
PushStatus::Empty => "(empty)",
PushStatus::Modified => "(modified)",
PushStatus::Unmodified => "",
};

writeln!(output, "{status_str}")?;
if status_str.is_empty() {
writeln!(output)?;
} else {
color_spec.clear();
output.set_color(color_spec.set_fg(Some(termcolor::Color::Yellow)))?;
writeln!(output, " {status_str}")?;
output.reset()?;
}
if is_last {
self.printed_top = true;
}
Expand Down

0 comments on commit fc6f820

Please sign in to comment.