History

remove tabled

Benedikt Mandelkow committed 2 years ago

Commit fcd585b1 parent 5fc379d3 files · +39 −171Browse files

Showing the changes to src (1 of 3 files). Show all

Unified · Split

src/plumbing/progress.rs+38−37
@@ -5,9 +5,6 @@ use std::{ · 4 unmodified lines
55
66 use crosstermion::crossterm::style::Stylize;
77 use owo_colors::OwoColorize;
8−use tabled::settings::peaker::PriorityMax;
9−use tabled::settings::{Extract, Style, Width};
10−use tabled::Tabled;
118
129 #[derive(Clone)]
1310 enum Usage {
@@ -73,33 +70,35 @@ struct Record { · 59 unmodified lines
7370 usage: Usage,
7471 }
7572
76−impl Tabled for Record {
77− const LENGTH: usize = 3;
73+// TODO implement this without table, how hard is it?
7874
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;
9177
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));
9890
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+// }
103102
104103 static GIT_CONFIG: &[Record] = &[
105104 Record {
@@ -575,16 +574,18 @@ pub fn show_progress() -> anyhow::Result<()> { · 469 unmodified lines
575574 .count()
576575 )?;
577576
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+ // );
588589 println!("{buf}");
589590 Ok(())
590591 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t