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

View file

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