Skip to content

Commit

Permalink
chore: bump tabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Nov 27, 2024
1 parent 4e25299 commit 2e1604a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
38 changes: 30 additions & 8 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 @@ -108,7 +108,7 @@ signal-hook = "0.3"
siphasher = "1"
strum = { version = "0.26", features = ["derive"] }
sys-info = "0.9"
tabled = { version = "0.16", features = ["ansi"] }
tabled = { version = "0.17", features = ["ansi"] }
tar = "0.4"
tempfile = "3"
tera = "1"
Expand Down
4 changes: 2 additions & 2 deletions src/cli/outdated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::ui::table;
use eyre::Result;
use indexmap::IndexMap;
use tabled::settings::location::ByColumnName;
use tabled::settings::Disable;
use tabled::settings::Remove;

/// Shows outdated tool versions
///
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Outdated {
fn display(&self, outdated: Vec<OutdatedInfo>) -> Result<()> {
let mut table = tabled::Table::new(outdated);
if !self.bump {
table.with(Disable::column(ByColumnName::new("bump")));
table.with(Remove::column(ByColumnName::new("bump")));
}
table::default_style(&mut table, self.no_header);
miseprintln!("{table}");
Expand Down
8 changes: 4 additions & 4 deletions src/ui/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use console::style;
use tabled::settings::object::{Columns, Rows};
use tabled::settings::peaker::PriorityMax;
use tabled::settings::width::{MinWidth, Wrap};
use tabled::settings::{Disable, Format, Margin, Modify, Padding, Settings, Style, Width};
use tabled::settings::{Format, Margin, Modify, Padding, Remove, Settings, Style, Width};
use tabled::Table;

use crate::env::TERM_WIDTH;
Expand All @@ -14,7 +14,7 @@ type SettingMinWidth = Settings<SettingPriority, MinWidth>;

pub fn term_size_settings() -> SettingMinWidth {
Settings::default()
.with(Width::wrap(*TERM_WIDTH).priority(PriorityMax))
.with(Width::wrap(*TERM_WIDTH).priority(PriorityMax::default()))
.with(Width::increase(*TERM_WIDTH))
// .with(Height::limit(*TERM_HEIGHT))
// .with(Height::increase(*TERM_HEIGHT))
Expand All @@ -24,7 +24,7 @@ pub fn default_style(table: &mut Table, no_headers: bool) {
let header = |h: &_| style(h).italic().magenta().to_string();

if no_headers || !console::user_attended() || cfg!(test) {
table.with(Disable::row(Rows::first()));
table.with(Remove::row(Rows::first()));
} else {
table.with(Modify::new(Rows::first()).with(Format::content(header)));
}
Expand All @@ -40,6 +40,6 @@ pub fn default_style(table: &mut Table, no_headers: bool) {

pub fn disable_columns(table: &mut Table, col_idxs: Vec<usize>) {
for idx in col_idxs {
table.with(Disable::column(Columns::single(idx)));
table.with(Remove::column(Columns::single(idx)));
}
}

0 comments on commit 2e1604a

Please sign in to comment.