Showing the changes to src (1 of 3 files). Show all
Unified · Split
| @@ -5,9 +5,6 @@ use std::{ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | use crosstermion::crossterm::style::Stylize; |
| 7 | 7 | use owo_colors::OwoColorize; |
| 8 | −use tabled::settings::peaker::PriorityMax; | |
| 9 | −use tabled::settings::{Extract, Style, Width}; | |
| 10 | −use tabled::Tabled; | |
| 11 | 8 | |
| 12 | 9 | #[derive(Clone)] |
| 13 | 10 | enum Usage { |
| @@ -73,33 +70,35 @@ struct Record { · 59 unmodified lines | ||
| 73 | 70 | usage: Usage, |
| 74 | 71 | } |
| 75 | 72 | |
| 76 | −impl Tabled for Record { | |
| 77 | − const LENGTH: usize = 3; | |
| 73 | +// TODO implement this without table, how hard is it? | |
| 78 | 74 | |
| 79 | − fn fields(&self) -> Vec<Cow<'_, str>> { | |
| 80 | − let mut tokens = self.config.split('.'); | |
| 81 | − let mut buf = vec![{ | |
| 82 | − let name = tokens.next().expect("present"); | |
| 83 | − if name == "gitoxide" { | |
| 84 | − name.bold().green() | |
| 85 | − } else { | |
| 86 | − name.bold() | |
| 87 | − } | |
| 88 | − .to_string() | |
| 89 | − }]; | |
| 90 | − buf.extend(tokens.map(ToOwned::to_owned)); | |
| 75 | +// impl Tabled for Record { | |
| 76 | +// const LENGTH: usize = 3; | |
| 91 | 77 | |
| 92 | − vec![ | |
| 93 | − Cow::Borrowed(self.usage.icon()), | |
| 94 | − buf.join(".").into(), | |
| 95 | − self.usage.to_string().into(), | |
| 96 | − ] | |
| 97 | − } | |
| 78 | +// fn fields(&self) -> Vec<Cow<'_, str>> { | |
| 79 | +// let mut tokens = self.config.split('.'); | |
| 80 | +// let mut buf = vec![{ | |
| 81 | +// let name = tokens.next().expect("present"); | |
| 82 | +// if name == "gitoxide" { | |
| 83 | +// name.bold().green() | |
| 84 | +// } else { | |
| 85 | +// name.bold() | |
| 86 | +// } | |
| 87 | +// .to_string() | |
| 88 | +// }]; | |
| 89 | +// buf.extend(tokens.map(ToOwned::to_owned)); | |
| 98 | 90 | |
| 99 | − fn headers() -> Vec<Cow<'static, str>> { | |
| 100 | − vec!["icon".into(), "key".into(), "info".into()] | |
| 101 | − } | |
| 102 | −} | |
| 91 | +// vec![ | |
| 92 | +// Cow::Borrowed(self.usage.icon()), | |
| 93 | +// buf.join(".").into(), | |
| 94 | +// self.usage.to_string().into(), | |
| 95 | +// ] | |
| 96 | +// } | |
| 97 | + | |
| 98 | +// fn headers() -> Vec<Cow<'static, str>> { | |
| 99 | +// vec!["icon".into(), "key".into(), "info".into()] | |
| 100 | +// } | |
| 101 | +// } | |
| 103 | 102 | |
| 104 | 103 | static GIT_CONFIG: &[Record] = &[ |
| 105 | 104 | Record { |
| @@ -575,16 +574,18 @@ pub fn show_progress() -> anyhow::Result<()> { · 469 unmodified lines | ||
| 575 | 574 | .count() |
| 576 | 575 | )?; |
| 577 | 576 | |
| 578 | − let mut table = tabled::Table::new(sorted); | |
| 579 | − let table = table.with(Style::blank()).with(Extract::rows(1..)); | |
| 580 | − println!( | |
| 581 | − "{}", | |
| 582 | − if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() { | |
| 583 | − table.with(Width::wrap(w as usize).keep_words().priority::<PriorityMax>()) | |
| 584 | − } else { | |
| 585 | − table | |
| 586 | − } | |
| 587 | − ); | |
| 577 | + // TODO implement this without table, how hard is it? | |
| 578 | + | |
| 579 | + // let mut table = tabled::Table::new(sorted); | |
| 580 | + // let table = table.with(Style::blank()).with(Extract::rows(1..)); | |
| 581 | + // println!( | |
| 582 | + // "{}", | |
| 583 | + // if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() { | |
| 584 | + // table.with(Width::wrap(w as usize).keep_words().priority::<PriorityMax>()) | |
| 585 | + // } else { | |
| 586 | + // table | |
| 587 | + // } | |
| 588 | + // ); | |
| 588 | 589 | println!("{buf}"); |
| 589 | 590 | Ok(()) |
| 590 | 591 | } |