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

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