Skip to content

Commit

Permalink
upgrade tabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jan 10, 2023
1 parent f9312d5 commit 7aed326
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ futures-lite = { version = "1.12.0", optional = true, default-features = false,

# for progress
owo-colors = "3.5.0"
tabled = { version = "0.8.0", default-features = false }
tabled = { version = "0.10.0", default-features = false }

document-features = { version = "0.2.0", optional = true }

Expand Down
11 changes: 8 additions & 3 deletions src/plumbing/progress.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::fmt::{Display, Formatter};

use crosstermion::crossterm::style::Stylize;
Expand Down Expand Up @@ -69,7 +70,7 @@ struct Record {
impl Tabled for Record {
const LENGTH: usize = 3;

fn fields(&self) -> Vec<String> {
fn fields(&self) -> Vec<Cow<'_, str>> {
let mut tokens = self.config.split('.');
let mut buf = vec![{
let name = tokens.next().expect("present");
Expand All @@ -82,10 +83,14 @@ impl Tabled for Record {
}];
buf.extend(tokens.map(ToOwned::to_owned));

vec![self.usage.icon().into(), buf.join("."), self.usage.to_string()]
vec![
Cow::Borrowed(self.usage.icon()),
buf.join(".").into(),
self.usage.to_string().into(),
]
}

fn headers() -> Vec<String> {
fn headers() -> Vec<Cow<'static, str>> {
vec![]
}
}
Expand Down

0 comments on commit 7aed326

Please sign in to comment.