History

remove tabled

Benedikt Mandelkow committed 2 years ago

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

Unified · Split

3 files
  1. Cargo.lock +1 −133
  2. Cargo.toml +0 −1
  3. src/plumbing/progress.rs +38 −37
Cargo.lock+1−133
@@ -51,15 +51,6 @@ version = "0.1.6" · 50 unmodified lines
51source = "registry+https://github.com/rust-lang/crates.io-index"51source = "registry+https://github.com/rust-lang/crates.io-index"
52checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"52checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
53 53
54[[package]]
55name = "ansi-str"
56version = "0.8.0"
57source = "registry+https://github.com/rust-lang/crates.io-index"
58checksum = "1cf4578926a981ab0ca955dc023541d19de37112bc24c1a197bd806d3d86ad1d"
59dependencies = [
60 "ansitok",
61]
62
63[[package]]54[[package]]
64name = "ansiterm"55name = "ansiterm"
65version = "0.12.2"56version = "0.12.2"
@@ -69,16 +60,6 @@ dependencies = [ · 3 unmodified lines
69 "winapi",60 "winapi",
70]61]
71 62
72[[package]]
73name = "ansitok"
74version = "0.2.0"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76checksum = "220044e6a1bb31ddee4e3db724d29767f352de47445a6cd75e1a173142136c83"
77dependencies = [
78 "nom",
79 "vte",
80]
81
82[[package]]63[[package]]
83name = "anstream"64name = "anstream"
84version = "0.6.5"65version = "0.6.5"
@@ -139,12 +120,6 @@ version = "1.6.0" · 54 unmodified lines
139source = "registry+https://github.com/rust-lang/crates.io-index"120source = "registry+https://github.com/rust-lang/crates.io-index"
140checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"121checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
141 122
142[[package]]
143name = "arrayvec"
144version = "0.5.2"
145source = "registry+https://github.com/rust-lang/crates.io-index"
146checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
147
148[[package]]123[[package]]
149name = "arrayvec"124name = "arrayvec"
150version = "0.7.4"125version = "0.7.4"
@@ -448,12 +423,6 @@ version = "3.14.0" · 297 unmodified lines
448source = "registry+https://github.com/rust-lang/crates.io-index"423source = "registry+https://github.com/rust-lang/crates.io-index"
449checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"424checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
450 425
451[[package]]
452name = "bytecount"
453version = "0.6.7"
454source = "registry+https://github.com/rust-lang/crates.io-index"
455checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
456
457[[package]]426[[package]]
458name = "byteorder"427name = "byteorder"
459version = "1.5.0"428version = "1.5.0"
@@ -1279,7 +1248,6 @@ dependencies = [ · 819 unmodified lines
1279 "owo-colors",1248 "owo-colors",
1280 "prodash 28.0.0",1249 "prodash 28.0.0",
1281 "serde_derive",1250 "serde_derive",
1282 "tabled",
1283 "terminal_size",1251 "terminal_size",
1284 "time",1252 "time",
1285 "tracing",1253 "tracing",
@@ -3486,12 +3454,6 @@ version = "0.3.17" · 2200 unmodified lines
3486source = "registry+https://github.com/rust-lang/crates.io-index"3454source = "registry+https://github.com/rust-lang/crates.io-index"
3487checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"3455checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
3488 3456
3489[[package]]
3490name = "minimal-lexical"
3491version = "0.2.1"
3492source = "registry+https://github.com/rust-lang/crates.io-index"
3493checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
3494
3495[[package]]3457[[package]]
3496name = "miniz_oxide"3458name = "miniz_oxide"
3497version = "0.7.1"3459version = "0.7.1"
@@ -3544,16 +3506,6 @@ dependencies = [ · 46 unmodified lines
3544 "pin-utils",3506 "pin-utils",
3545]3507]
3546 3508
3547[[package]]
3548name = "nom"
3549version = "7.1.3"
3550source = "registry+https://github.com/rust-lang/crates.io-index"
3551checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
3552dependencies = [
3553 "memchr",
3554 "minimal-lexical",
3555]
3556
3557[[package]]3509[[package]]
3558name = "ntapi"3510name = "ntapi"
3559version = "0.4.1"3511version = "0.4.1"
@@ -3710,19 +3662,6 @@ version = "4.0.0" · 150 unmodified lines
3710source = "registry+https://github.com/rust-lang/crates.io-index"3662source = "registry+https://github.com/rust-lang/crates.io-index"
3711checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f"3663checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f"
3712 3664
3713[[package]]
3714name = "papergrid"
3715version = "0.11.0"
3716source = "registry+https://github.com/rust-lang/crates.io-index"
3717checksum = "9ad43c07024ef767f9160710b3a6773976194758c7919b17e63b863db0bdf7fb"
3718dependencies = [
3719 "ansi-str",
3720 "ansitok",
3721 "bytecount",
3722 "fnv",
3723 "unicode-width",
3724]
3725
3726[[package]]3665[[package]]
3727name = "parking"3666name = "parking"
3728version = "2.2.0"3667version = "2.2.0"
@@ -3889,30 +3828,6 @@ dependencies = [ · 160 unmodified lines
3889 "toml_edit",3828 "toml_edit",
3890]3829]
3891 3830
3892[[package]]
3893name = "proc-macro-error"
3894version = "1.0.4"
3895source = "registry+https://github.com/rust-lang/crates.io-index"
3896checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
3897dependencies = [
3898 "proc-macro-error-attr",
3899 "proc-macro2",
3900 "quote",
3901 "syn 1.0.109",
3902 "version_check",
3903]
3904
3905[[package]]
3906name = "proc-macro-error-attr"
3907version = "1.0.4"
3908source = "registry+https://github.com/rust-lang/crates.io-index"
3909checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
3910dependencies = [
3911 "proc-macro2",
3912 "quote",
3913 "version_check",
3914]
3915
3916[[package]]3831[[package]]
3917name = "proc-macro2"3832name = "proc-macro2"
3918version = "1.0.75"3833version = "1.0.75"
@@ -4646,32 +4561,6 @@ dependencies = [ · 727 unmodified lines
4646 "libc",4561 "libc",
4647]4562]
4648 4563
4649[[package]]
4650name = "tabled"
4651version = "0.15.0"
4652source = "registry+https://github.com/rust-lang/crates.io-index"
4653checksum = "4c998b0c8b921495196a48aabaf1901ff28be0760136e31604f7967b0792050e"
4654dependencies = [
4655 "ansi-str",
4656 "ansitok",
4657 "papergrid",
4658 "tabled_derive",
4659 "unicode-width",
4660]
4661
4662[[package]]
4663name = "tabled_derive"
4664version = "0.7.0"
4665source = "registry+https://github.com/rust-lang/crates.io-index"
4666checksum = "4c138f99377e5d653a371cdad263615634cfc8467685dfe8e73e2b8e98f44b17"
4667dependencies = [
4668 "heck",
4669 "proc-macro-error",
4670 "proc-macro2",
4671 "quote",
4672 "syn 1.0.109",
4673]
4674
4675[[package]]4564[[package]]
4676name = "tar"4565name = "tar"
4677version = "0.4.40"4566version = "0.4.40"
@@ -5034,7 +4923,7 @@ version = "3.0.0" · 356 unmodified lines
5034source = "registry+https://github.com/rust-lang/crates.io-index"4923source = "registry+https://github.com/rust-lang/crates.io-index"
5035checksum = "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db"4924checksum = "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db"
5036dependencies = [4925dependencies = [
5037 "arrayvec 0.7.4",4926 "arrayvec",
5038]4927]
5039 4928
5040[[package]]4929[[package]]
@@ -5129,27 +5018,6 @@ version = "0.9.4" · 88 unmodified lines
5129source = "registry+https://github.com/rust-lang/crates.io-index"5018source = "registry+https://github.com/rust-lang/crates.io-index"
5130checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"5019checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
5131 5020
5132[[package]]
5133name = "vte"
5134version = "0.10.1"
5135source = "registry+https://github.com/rust-lang/crates.io-index"
5136checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983"
5137dependencies = [
5138 "arrayvec 0.5.2",
5139 "utf8parse",
5140 "vte_generate_state_changes",
5141]
5142
5143[[package]]
5144name = "vte_generate_state_changes"
5145version = "0.1.1"
5146source = "registry+https://github.com/rust-lang/crates.io-index"
5147checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
5148dependencies = [
5149 "proc-macro2",
5150 "quote",
5151]
5152
5153[[package]]5021[[package]]
5154name = "waker-fn"5022name = "waker-fn"
5155version = "1.1.1"5023version = "1.1.1"
Cargo.toml+0−1
@@ -190,7 +190,6 @@ tracing = { version = "0.1.37", optional = true } · 189 unmodified lines
190owo-colors = "4.0.0"190owo-colors = "4.0.0"
191 191
192# for config-tree192# for config-tree
193tabled = { version = "0.15.0", features = ["ansi"] }
194terminal_size = "0.3.0"193terminal_size = "0.3.0"
195 194
196# Avoid pre-compiled binaries, see https://github.com/serde-rs/serde/issues/2538 and https://github.com/serde-rs/serde/pull/2590195# Avoid pre-compiled binaries, see https://github.com/serde-rs/serde/issues/2538 and https://github.com/serde-rs/serde/pull/2590
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}