Compare commits
3 commits
d2048d8a34
...
9720fd01fc
Author | SHA1 | Date | |
---|---|---|---|
9720fd01fc | |||
8550adf79e | |||
2b09872131 |
2 changed files with 13 additions and 11 deletions
|
@ -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)
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
Loading…
Reference in a new issue