Compare commits

...

3 commits

Author SHA1 Message Date
9720fd01fc feat(tui): hightlight repo alias in red when in alert
All checks were successful
Rust / build (push) Successful in 10m15s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m42s
2024-08-31 19:32:56 +01:00
8550adf79e fix(tui): remove logging from inside ui loop
All checks were successful
Rust / build (push) Successful in 10m6s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m7s
2024-08-31 19:26:20 +01:00
2b09872131 feat(tui): branch names look more like 'pills'
All checks were successful
Rust / build (push) Successful in 10m7s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m21s
Use round brackets
2024-08-31 19:20:50 +01:00
2 changed files with 13 additions and 11 deletions

View file

@ -1,3 +1,4 @@
use color_eyre::owo_colors::OwoColorize;
// //
use git_next_core::git::graph::Log; use git_next_core::git::graph::Log;
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -62,7 +63,6 @@ impl From<LogLine> for Line<'_> {
let pre = caps["pre"].to_owned(); let pre = caps["pre"].to_owned();
let hash = caps["hash"].to_owned(); let hash = caps["hash"].to_owned();
let message = caps["message"].to_owned(); let message = caps["message"].to_owned();
info!(branches=?caps["branches"], "raw branches");
let mut branches = BRANCHES let mut branches = BRANCHES
.captures_iter(&caps["branches"]) .captures_iter(&caps["branches"])
.map(|captures| captures["branch"].to_owned()) .map(|captures| captures["branch"].to_owned())
@ -80,16 +80,13 @@ impl From<LogLine> for Line<'_> {
} else { } else {
// line withbranches // line withbranches
let mut spans = vec![pre.into(), " ".into(), hash.into(), " ".into()]; let mut spans = vec![pre.into(), " ".into(), hash.into(), " ".into()];
info!(?branches, "matched branch list");
branches.sort(); branches.sort();
branches branches
.into_iter() .into_iter()
.map(|branch| Span::from(branch).style(Style::default().fg(Color::Blue))) .map(|branch| format!("({branch})"))
.for_each(|span| { .map(Span::from)
spans.push("[".into()); .map(|span| span.style(Style::default().fg(Color::White).bg(Color::Blue)))
spans.push(span); .for_each(|span| spans.push(span));
spans.push("]".into());
});
spans.push(" ".into()); spans.push(" ".into());
spans.push(message.into()); spans.push(message.into());
Line::from(spans) Line::from(spans)

View file

@ -36,11 +36,16 @@ impl<'a> Identity<'a> {
impl<'a> Identity<'a> { impl<'a> Identity<'a> {
fn spans(self) -> Vec<Span<'a>> { fn spans(self) -> Vec<Span<'a>> {
let label = self.label; let label = self.label;
let repo_alias = self.repo_alias; let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() {
Style::default().fg(Color::Black).bg(Color::Red)
} else {
Style::default().fg(Color::Cyan).bg(Color::Black)
});
let alert = self let alert = self
.alert .alert
.map_or(String::new(), |a| format!("{a} ")) .map_or(String::new(), |a| format!("{a} "))
.fg(Color::Red); .fg(Color::Black)
.bg(Color::Red);
let message = self.message; let message = self.message;
let main = self let main = self
.repo_branches .repo_branches
@ -56,7 +61,7 @@ impl<'a> Identity<'a> {
.map_or_else(|| "_".to_string(), |b| b.to_string()); .map_or_else(|| "_".to_string(), |b| b.to_string());
vec![ vec![
" ".into(), " ".into(),
Span::from(repo_alias.to_string()).style(Style::default().fg(Color::Blue)), repo_alias,
format!(" ({label}) ").into(), format!(" ({label}) ").into(),
alert, alert,
format!("({main}/{next}/{dev}) [").into(), format!("({main}/{next}/{dev}) [").into(),